Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions frameworks/C++/paozhu/paozhu_benchmark/common/cost_define.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
#define CONST_HTTP_BODY_POST_SIZE 33554432
#define CONST_HTTP_JSON_POST_SIZE 2097152

#define CONST_HTTP2_SlEEP_MIN_TIME 1100000

#define CONST_ORM_CLEAR_TIME 7200
#define CONST_ORM_CLEAR_NUMBER 1024
#define CONST_ORM_QUERY_CONNECT_TIMEOUT 30
#define CONST_ORM_QUERY_LOG_TIME 30

#define COOKIE_SESSION_NAME "PHPSESSID"
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <chrono>
#include "httppeer.h"
#include "techempower.h"
#include "request.h"
#include "techempower_json.h"
#include "datetime.h"
#include "func.h"
Expand Down Expand Up @@ -43,6 +44,7 @@ asio::awaitable<std::string> techempowerdb(std::shared_ptr<httppeer> peer)
myworld.where("id", rd_num);
myworld.limit(1);
co_await myworld.async_fetch_one();

peer->output = myworld.data_tojson();
co_return "";
}
Expand All @@ -64,14 +66,15 @@ asio::awaitable<std::string> techempowerqueries(std::shared_ptr<httppeer> peer)
}
auto myworld = orm::World();
myworld.record.reserve(get_num);
myworld.lock_conn();
for (unsigned int i = 0; i < get_num; i++)
{
myworld.wheresql.clear();
unsigned int rd_num = rand_range(1, 10000);
myworld.where("id", rd_num);
co_await myworld.async_fetch_append();
}

myworld.unlock_conn();
peer->output = myworld.to_json();
co_return "";
}
Expand All @@ -91,7 +94,7 @@ asio::awaitable<std::string> techempowerfortunes(std::shared_ptr<httppeer> peer)
std::sort(myfortune.record.begin(), myfortune.record.end(), [](const auto &lhs, const auto &rhs)
{ return lhs.message < rhs.message; });
peer->val["list"].set_array();
OBJ_ARRAY item;
obj_val item;
for (unsigned int i = 0; i < myfortune.record.size(); i++)
{
item["id"] = myfortune.record[i].id;
Expand Down Expand Up @@ -126,6 +129,7 @@ asio::awaitable<std::string> techempowerupdates(std::shared_ptr<httppeer> peer)
auto myworld = orm::World();
myworld.record.clear();
myworld.record.reserve(get_num);
myworld.lock_conn();
for (unsigned int i = 0; i < get_num; i++)
{
myworld.wheresql.clear();
Expand All @@ -139,6 +143,7 @@ asio::awaitable<std::string> techempowerupdates(std::shared_ptr<httppeer> peer)
co_await myworld.async_update("randomnumber");
}
}
myworld.unlock_conn();
peer->output = myworld.to_json();
co_return "";
}
Expand Down Expand Up @@ -247,4 +252,4 @@ asio::awaitable<std::string> techempowercached_db(std::shared_ptr<httppeer> peer
co_return "";
}

}// namespace http
}// namespace http
Loading
Loading