Сервер сокетов C ++ - Невозможно насыщать процессор

Я разработал мини-HTTP-сервер на C ++, используя boost :: asio, и теперь я нагрузочно тестирую его с несколькими клиентами, и мне не удается приблизиться к насыщению ЦП. Я тестирую на экземпляре Amazon EC2 и получаю около 50% использования одного процессора, 20% другого, а остальные два простаивают (согласно htop).

Подробности:

The server fires up one thread per core Requests are received, parsed, processed, and responses are written out The requests are for data, which is read out of memory (read-only for this test) I'm 'loading' the server using two machines, each running a java application, running 25 threads, sending requests I'm seeing about 230 requests/sec throughput (this is application requests, which are composed of many HTTP requests)

Итак, что я должен посмотреть, чтобы улучшить этот результат? Учитывая, что процессор в основном простаивает, я бы хотел использовать эту дополнительную емкость, чтобы получить более высокую пропускную способность, скажем, 800 запросов в секунду или что-то еще.

У меня были идеи:

The requests are very small, and often fulfilled in a few ms, I could modify the client to send/compose bigger requests (perhaps using batching) I could modify the HTTP server to use the Select design pattern, is this appropriate here? I could do some profiling to try to understand what the bottleneck's are/is

Ответы на вопрос(5)

Ваш ответ на вопрос