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

Very important setting for performance #8

Open
sazo opened this issue Nov 12, 2018 · 5 comments
Open

Very important setting for performance #8

sazo opened this issue Nov 12, 2018 · 5 comments

Comments

@sazo
Copy link

sazo commented Nov 12, 2018

After 1.5 weeks of debugging (yes i kind you not) i found the stream socket setting 'tcp_nodelay' to be very important for performance.

See http://php.net/manual/en/context.socket.php

With tcp_nodelay set to false

php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.12199187278748 :       TLS connecting"
php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: Subscribing to heartbeat Inbox _INBOX.5be973f68b1f9"
php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.0010449886322021 :       Preparing data for client connect"
php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 8.8930130004883E-5 :       Subscribing for ConnectResponse"
php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.00017595291137695 :       Auto unscribing after 1 message is received"
php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.00022983551025391 :       Discovery"
php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.00027894973754883 :       After Discovery"
php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.04311203956604 :         Received ConnectResponse"
php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.04382586479187 :         After wait"
php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.043874025344849 :         Connect Request"
php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.16754603385925 :       Connecting"
php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.0039598941802979 :         Dispatch send request"
php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.17437696456909 :       Sending email"
php-fpm_1                 | 172.151.0.6 -  12/Nov/2018:12:37:10 +0000 "GET /index.php" 302
php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: Closing down"
php-fpm_1                 | [12-Nov-2018 12:37:10] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: Closing down"

With tcp_nodelay set to true

php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.074014902114868 :       TLS connecting"
php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: Subscribing to heartbeat Inbox _INBOX.5be974612a673"
php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.00038790702819824 :       Preparing data for client connect"
php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 7.319450378418E-5 :       Subscribing for ConnectResponse"
php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.0001671314239502 :       Auto unscribing after 1 message is received"
php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.00023007392883301 :       Discovery"
php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.00029301643371582 :       After Discovery"
php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.0010581016540527 :         Received ConnectResponse"
php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.0013542175292969 :         After wait"
php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.0013811588287354 :         Connect Request"
php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.076140165328979 :       Connecting"
php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.0015089511871338 :         Dispatch send request"
php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: 0.079082012176514 :       Sending email"
php-fpm_1                 | 172.151.0.6 -  12/Nov/2018:12:38:56 +0000 "GET /index.php" 302
php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: Closing down"
php-fpm_1                 | [12-Nov-2018 12:38:57] WARNING: [pool www] child 21 said into stderr: "NOTICE: PHP message: Closing down"

Cut down response time by ~100MS

@byrnedo
Copy link
Owner

byrnedo commented Nov 14, 2018

@sazo nice catch!
I rely on phpnats so once the fix is made there then one can set that with the options here.

@fizzka
Copy link

fizzka commented Jan 8, 2019

it looks like maintainer has left project(

@sazo
Copy link
Author

sazo commented Jan 9, 2019

@fizzka we ended up forking this repo and the main nats repo. :) We are planing implementing non-blocking socket stream for performance reasons

@byrnedo
Copy link
Owner

byrnedo commented Jan 9, 2019

@sazo It'd be great if you wanted to make a pull request with those changes in both?

@AlanSyue
Copy link

AlanSyue commented Jul 6, 2022

@sazo Could you please tell me how to set it? Thanks!

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

4 participants