Skip to content

Commit a0ebdee

Browse files
authored
[Update Paozhu] Update built-in variables (TechEmpower#9746)
* Paozhu update * Update orm file * [Paozhu] update orm file * update paozhu * update paozhu
1 parent ab110c2 commit a0ebdee

File tree

10 files changed

+1512
-1393
lines changed

10 files changed

+1512
-1393
lines changed

frameworks/C++/paozhu/paozhu_benchmark/common/cost_define.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@
99
#define CONST_HTTP_BODY_POST_SIZE 33554432
1010
#define CONST_HTTP_JSON_POST_SIZE 2097152
1111

12+
#define CONST_HTTP2_SlEEP_MIN_TIME 1100000
13+
1214
#define CONST_ORM_CLEAR_TIME 7200
1315
#define CONST_ORM_CLEAR_NUMBER 1024
1416
#define CONST_ORM_QUERY_CONNECT_TIMEOUT 30
17+
#define CONST_ORM_QUERY_LOG_TIME 30
1518

19+
#define COOKIE_SESSION_NAME "PHPSESSID"
1620
#endif

frameworks/C++/paozhu/paozhu_benchmark/controller/src/techempower.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <chrono>
77
#include "httppeer.h"
88
#include "techempower.h"
9+
#include "request.h"
910
#include "techempower_json.h"
1011
#include "datetime.h"
1112
#include "func.h"
@@ -43,6 +44,7 @@ asio::awaitable<std::string> techempowerdb(std::shared_ptr<httppeer> peer)
4344
myworld.where("id", rd_num);
4445
myworld.limit(1);
4546
co_await myworld.async_fetch_one();
47+
4648
peer->output = myworld.data_tojson();
4749
co_return "";
4850
}
@@ -64,14 +66,15 @@ asio::awaitable<std::string> techempowerqueries(std::shared_ptr<httppeer> peer)
6466
}
6567
auto myworld = orm::World();
6668
myworld.record.reserve(get_num);
69+
myworld.lock_conn();
6770
for (unsigned int i = 0; i < get_num; i++)
6871
{
6972
myworld.wheresql.clear();
7073
unsigned int rd_num = rand_range(1, 10000);
7174
myworld.where("id", rd_num);
7275
co_await myworld.async_fetch_append();
7376
}
74-
77+
myworld.unlock_conn();
7578
peer->output = myworld.to_json();
7679
co_return "";
7780
}
@@ -91,7 +94,7 @@ asio::awaitable<std::string> techempowerfortunes(std::shared_ptr<httppeer> peer)
9194
std::sort(myfortune.record.begin(), myfortune.record.end(), [](const auto &lhs, const auto &rhs)
9295
{ return lhs.message < rhs.message; });
9396
peer->val["list"].set_array();
94-
OBJ_ARRAY item;
97+
obj_val item;
9598
for (unsigned int i = 0; i < myfortune.record.size(); i++)
9699
{
97100
item["id"] = myfortune.record[i].id;
@@ -126,6 +129,7 @@ asio::awaitable<std::string> techempowerupdates(std::shared_ptr<httppeer> peer)
126129
auto myworld = orm::World();
127130
myworld.record.clear();
128131
myworld.record.reserve(get_num);
132+
myworld.lock_conn();
129133
for (unsigned int i = 0; i < get_num; i++)
130134
{
131135
myworld.wheresql.clear();
@@ -139,6 +143,7 @@ asio::awaitable<std::string> techempowerupdates(std::shared_ptr<httppeer> peer)
139143
co_await myworld.async_update("randomnumber");
140144
}
141145
}
146+
myworld.unlock_conn();
142147
peer->output = myworld.to_json();
143148
co_return "";
144149
}
@@ -247,4 +252,4 @@ asio::awaitable<std::string> techempowercached_db(std::shared_ptr<httppeer> peer
247252
co_return "";
248253
}
249254

250-
}// namespace http
255+
}// namespace http

0 commit comments

Comments
 (0)