Code Monkey home page Code Monkey logo

Comments (14)

walkor avatar walkor commented on July 21, 2024

Please open /etc/sysctl.conf and add these

net.core.somaxconn = 65535
net.ipv4.tcp_max_syn_backlog = 262144
net.core.netdev_max_backlog = 30000
net.ipv4.tcp_tw_recycle = 0
fs.file-max = 6815744
net.netfilter.nf_conntrack_max = 2621440

settings , then run command sysctl -p.
Finally restart gatewayWorker.

from gatewayworker.

sm2017 avatar sm2017 commented on July 21, 2024

1- Is establishing connection between register , business workers and gateways in synchronous mode ?
2- Why I have 600K total_request in my register? When a request send to register? I think just in business worker and gateways starts (currently I have 150 gateways and 150 business worker and I know that just few business worker exits per day on restart them selves , less than 10 per day) , So why I have 600K request in register??

from gatewayworker.

sm2017 avatar sm2017 commented on July 21, 2024

I add settings in /etc/sysctl.conf

Now in start in have the following error

stream_socket_client(): unable to connect to tcp://10.10.10.10:2315 (Connection refused)
vendor/workerman/gateway-worker/src/Lib/Gateway.php:363

10.10.10.10:2315 is a gateway
Also I stop firewalld

from gatewayworker.

sm2017 avatar sm2017 commented on July 21, 2024

What about

stream_socket_client(): unable to connect to tcp://10.10.10.11:2315 (Operation now in progress)
vendor/workerman/gateway-worker/src/Lib/Gateway.php:363

from gatewayworker.

sm2017 avatar sm2017 commented on July 21, 2024

After add settings in /etc/sysctl.conf (Connection timed out) solved at startup but it occurred a few in runtimes

from gatewayworker.

walkor avatar walkor commented on July 21, 2024

May be high load caused the problem.
I'm not sure.

from gatewayworker.

sm2017 avatar sm2017 commented on July 21, 2024

Who exactly can help me? Linux expert? Network expert?...

from gatewayworker.

sm2017 avatar sm2017 commented on July 21, 2024

@walkor still having stream_socket_client(): unable to connect to tcp://10.10.10.11:2321 (Connection timed out) issue

  • Can you tell me how much is timeout?
  • When you connect from a business worker to a gateway?

from gatewayworker.

walkor avatar walkor commented on July 21, 2024

Default timeout is 3 seconds and can be modified by GatewayWorker\Lib\Gateway::$connectTimeout.
When you call methods Gateway::XXX like Gateway::isUidOnline Gateway:: isOnline Gateway:: getAllClientSessions Gateway::getClientSessionsByGroup Gateway:: getAllClientCount Gateway:: getClientCountByGroup Gateway:: getClientIdByUid Gateway::getSession the business worker will connect to gateway.

from gatewayworker.

sm2017 avatar sm2017 commented on July 21, 2024

@walkor is the connection keep a lived? Or it is disconnect and when needed it connected again?

from gatewayworker.

walkor avatar walkor commented on July 21, 2024

it is disconnect and when needed it connected again.

from gatewayworker.

sm2017 avatar sm2017 commented on July 21, 2024

@walkor , How can I change the behavior?
As you know establishing TCP connection is expensive , I use sendToClient, sendToUid and sendToGroup a lot and it is better that connection keep a-lived during multi method calls

closing and establishing connection is not optimized

from gatewayworker.

walkor avatar walkor commented on July 21, 2024

sendToClient, sendToUid and sendToGroup will not reconnect.

from gatewayworker.

MajidJafari avatar MajidJafari commented on July 21, 2024

For +300k concurrent connection:

Set these variables in /etc/sysctl.conf:

fs.file-max = 10000000 
fs.nr_open = 10000000

Also, change these variables in /etc/security/limits.conf:

* soft nofile 10000000
* hard nofile 10000000
root soft nofile 10000000
root hard nofile 10000000

And finally, increase TCP buffers in /etc/sysctl.conf, too:

net.ipv4.tcp_mem = 786432 1697152 1945728
net.ipv4.tcp_rmem = 4096 4096 16777216
net.ipv4.tcp_wmem = 4096 4096 16777216

for more information please refer to https://www.linangran.com/?p=547

from gatewayworker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.