Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

是否支持多线程的请求? #9

Closed
PL23K opened this issue Nov 29, 2019 · 6 comments
Closed

是否支持多线程的请求? #9

PL23K opened this issue Nov 29, 2019 · 6 comments

Comments

@PL23K
Copy link

PL23K commented Nov 29, 2019

不知道这个库跟“Pistache”比较怎么样?Pistache在自我介绍的时候有提多线程支持,不知道webcc是否支持?

@PL23K
Copy link
Author

PL23K commented Dec 4, 2019

我通过项目中的helloworld示例,修改server.run(10); HelloWorld视图中加入线程延时并打印运行时间,发现,同时发起两个请求时,请求并不是并行执行的,还是一个请求执行完了之后再执行第二个请求。 所以server.run(10)中的worker个数和并发请求的处理无关?

@PL23K
Copy link
Author

PL23K commented Dec 4, 2019

请问如何让server能够处理并发?

@xiaobingcaicai
Copy link

同问

@sprinfall
Copy link
Owner

谢谢反馈,正在调查原因,以前没有这个问题。我会尽快解决。

@sprinfall
Copy link
Owner

我测试过了,没有问题,诸位可以参考新加的 examples/concurrency_test.cc 里的写法,每次调用都创建一个新的 ClientSession,不要在多个线程间复用 ClientSession 对象。
此外,程序第一次运行可能会慢一些,这是 ASIO 或底层 socket 的问题,暂时我还不太清楚。

@PL23K
Copy link
Author

PL23K commented Dec 31, 2019

thinks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants