Dear Harshit,
thank you for your responses. I will try to separate my answer into three topics.
Number of TCP connections
13 open HTTP connections feels like a reasonable number that does not immediately reveal an overcommitment situation on this regard. 246 total connections over the lifetime of the node does not reveal any high usage either, while you might have just restarted the node/cluster?
However, a sensible assessment on this matter can only be made when monitoring and recording those metrics over a period of time because looking at a single sample does not reveal any access patterns of applications. Finding out about this is important because overcommitment situations might happen infrequently.
TCP connections dying
On the other hand, you might also being tripped by quite the opposite instead. That is, that database connections might be dying silently without the driver being able to recognize it. This situation might lead to similar errors in userspace.
In order to find out more about this, can I humbly ask you again about the topics I elaborated at Connection Refused error Infrequently - #9 by amotl? In particular, I would like to point out Networking robustness and resiliency on Azure and beyond (AWS, GCP, AliCloud) · Issue #10779 · crate/crate · GitHub in this context. To become more specific, my questions are:
- How does your hosting environment look like? Are you running on bare metal, virtual machines or some form of containers? Which one?
- How does your network look like? Are you running everything on the same host or do you use multiple hosts? If so, how are they connected to each other?
- How does your application container look like? Are you running Apache, PHP-FPM, uWSGI or some other service in this regard for hosting your PHP application as a web application? Or do you invoke batch jobs against the database and don’t run any web application at all?
Answers to those questions will help us to get reasonable insights into the system you are operating. Any other kinds of elaborations about your scenario and workload characteristics will also help.
TCP connection reuse
Last but not least, I would like to reflect on the situation about invoking HTTP requests from PHP in general. That is, when considering a typical web application responding to requests from HTTP clients. In this regard, I also want to ask you if this is actually the case on your end, otherwise I can only guess.
Specifically, I am wondering how any type of connection reuse for HTTP connections might actually work with PHP. For connecting to databases, PHP has a special feature called »Persistent Database Connections«, implemented in, e.g., mysql_pconnect
or pg_pconnect
. What is called “persistent connections” here is actually “connection pooling” in a different jargon. While I am not an expert in this area, I don’t know about any way to have connection pooling/reuse for HTTP connections invoked from PHP.
With kind regards,
Andreas.