More requests and threads

This commit is contained in:
pudepiedj 2024-02-21 11:39:48 +00:00
parent 760b6d639b
commit f7e29e5248
2 changed files with 5 additions and 5 deletions

View file

@ -85,8 +85,8 @@ if __name__ == "__main__":
url = "http://localhost:8080/completion"
num_requests = 40
q = Queue(maxsize = 40)
num_requests = 256
q = Queue(maxsize = 256)
threads = []
bar = make_empty_bar(num_requests)

View file

@ -93,10 +93,10 @@
#ifndef CPPHTTPLIB_COMPRESSION_BUFSIZ
#define CPPHTTPLIB_COMPRESSION_BUFSIZ size_t(16384u)
#endif
// the value here (8u, 16u, 32u, etc) is what governs max threads at 5126
#ifndef CPPHTTPLIB_THREAD_POOL_COUNT
#define CPPHTTPLIB_THREAD_POOL_COUNT \
((std::max)(32u, std::thread::hardware_concurrency() > 0 \
((std::max)(128u, std::thread::hardware_concurrency() > 0 \
? std::thread::hardware_concurrency() - 1 \
: 0))
#endif
@ -581,7 +581,7 @@ public:
class ThreadPool : public TaskQueue {
public:
explicit ThreadPool(size_t n) : shutdown_(false) {
explicit ThreadPool(size_t n) : shutdown_(false) { // n is CPPHTTPLIB_THREAD_POOL_COUNT
while (n) {
threads_.emplace_back(worker(*this));
n--;