0

I have installed php/swoole on my server and configured it using Laravel swoole

Now The problem is everything works fine until total requests per second number increase more than 1000 requests.
Swoole will log an error and not responding to user !
I have set Operating system ulimit number to 50000
But still get same error ! Searching all over internet and find nothing !
Os Centos 7
Server is good enough to handle more than 1k requests per second

If you have any experience about this please share it with me

Note:
When swoole starts, it logs this error too:
set_max_connection: max_connection is exceed the maximum value, it's reset to 1024

Mr.Apr
  • 66
  • 1
  • 6
  • You have answered yourself. The problem is not the upper limit of open files/sockets. Instead is the maximum number configured in swoole. I don't know where configure this, but take a look to the source https://github.com/swoole/swoole-src/blob/master/src/server/master.cc – Sourcerer Jan 18 '21 at 19:49
  • @Sourcerer There is a Configuration for that and I've changed it to more than 1024! But at the run time it tells max_connection is exceed the maximum value, and resets it to the default ! I think there is something that should be changed in server – Mr.Apr Jan 19 '21 at 06:55
  • In the code, it uses the minimum between the configuration parameter and compilation constant. Could you check the value of compilation constant? – Sourcerer Jan 19 '21 at 07:39
  • @Sourcerer How should I check it ? – Mr.Apr Jan 19 '21 at 12:05
  • Check the code, e.g. https://github.com/swoole/swoole-src/search?q=SW_MAX_CONNECTION. But, I did it. It's 100000, so this is not your problem... :-/ – Sourcerer Jan 19 '21 at 13:24

1 Answers1

1

Ok I have figured it out.
lets first say that how I ran PHP-Swoole process: .
I have made a systemd service in centos in order to launch swoole process all the time in any situation..
So the ULimit command sets ulimit for current shell that you are in it. Not the systemd shell that is running swoole starter process..
For that you need to add LimitNOFILE=100000 option under systemd [Service] section block.
And with a restart everything works fine.

Mr.Apr
  • 66
  • 1
  • 6