swoole-src: Nginx + Swoole performance too slow

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a simple script for reproducing the error. Run the swoole_http_server. Then test its performance using wrk with the following command wrk http://127.0.0.1:9501 -c 1000 -t 48 -d 5

The swoole server is configured as follows

<?php
$http = new swoole_http_server("127.0.0.1", 9501, SWOOLE_BASE);
$http->on('request', function ($request, swoole_http_response $response) {
    $response->header('Last-Modified', 'Thu, 18 Jun 2015 10:24:27 GMT');
    $response->header('E-Tag', '55829c5b-17');
    $response->header('Accept-Ranges', 'bytes');
    $response->end("<h1>\nHello Swoole.\n</h1>");
});
$http->start();
  1. What did you expect to see? The performance is close to that of static nginx as what was stated in the documentation. I am expecting 1M request/second

  2. What did you see instead? I see 1 over 20 of the performance only, I am expecting that it would be close to static nginx of 1M+ requests/second. Instead i only got 40k+ request/second.

  3. What version of Swoole are you using (show your php --ri swoole)? swoole 4.2.7

  4. What is your machine environment used (including version of kernel & php & gcc) ? CentOS 7 1708 php 7.1 2x Xeon e5 2670 gcc 4.8.5 20150623 kernel 3.10.0-862.2.3.el7.x86_64

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (11 by maintainers)

Most upvoted comments

@jobs-git Swoole needs to provide a Unix Socket option and not only TCP.