... | ... | @@ -11,10 +11,10 @@ |
|
|
|
|
|
### 8.2、测试方案和结果
|
|
|
|
|
|
我们只是为了测试drogon框架的性能,因而要尽量简化controller的处理,我们只做了一个HttpSimpleController,注册到`/benchmark`路径上。controller对任何请求都返回`<p>Hello, world!</p>`。设置drogon线程数为16。handler函数的代码如下:
|
|
|
我们只是为了测试drogon框架的性能,因而要尽量简化controller的处理,我们只做了一个HttpSimpleController,注册到`/benchmark`路径上。controller对任何请求都返回`<p>Hello, world!</p>`。设置drogon线程数为16。handler函数的代码如下, 你可以在`drogon/examples/benchmark`目录找到这些源码:
|
|
|
|
|
|
```c++
|
|
|
void TestController::asyncHandleHttpRequest(const HttpRequestPtr &req, const std::function<void(const HttpResponsePtr &)> &callback)
|
|
|
void BenchmarkCtrl::asyncHandleHttpRequest(const HttpRequestPtr& req,const std::function<void (const HttpResponsePtr &)> & callback)
|
|
|
{
|
|
|
//write your application logic here
|
|
|
auto resp = HttpResponse::newHttpResponse();
|
... | ... | |
... | ... | |