Connection Refused error Infrequently

Dear Harshit,

thank you. Let me point you towards three different aspects I would like to gather more information about.

Hosting/runtime environment

We really need more details here to get an idea about the exact environment in order to be able to eventually figure out what might occasionally be going wrong on your end wrt. network connectivity issues. There are so many possibilities.

Ubuntu 18 could be running on your workstation or on a remote host, either hosted on a bare metal machine or by any means of virtualization, either on dedicated hardware or within a shared environment operated by other people (sometimes also known as the cloud). Also, the address localhost:4200 might either be really on the local host or might get forwarded to another machine by any means.

Workload

Traffic characteristics

After knowing more details about the environment, we might want to shed more light onto the kind of workload and/or traffic your instance of CrateDB is receiving. This is, in order to figure out whether the database might be in a situation to be overloaded in a manner that is beyond the system resources it has available, which in turn might still lead to some kind of resource exhaustion which is then observable through connections being rejected.

Client behavior

That includes investigating how the HTTP client (is it RingPHP? [1]) is exactly interacting with the database and whether it will just exhaust available resources quickly by not reusing TCP connections appropriately [2]. In order to do that responsibly, any database driver should use some form of connection pooling, where the number of database connections will be limited to the pool size. In high traffic scenarios, this is absolutely crucial.

Are you able to provide more details about the aspects I’ve outlined?

Thank you in advance and with kind regards,
Andreas.

[1] GitHub - guzzle/RingPHP: Simple handler system used to power clients and servers in PHP (this project is no longer used in Guzzle 6+)
[2] On this matter, looking into the metrics re. number of active connections as outlined by @proddata might also give us more insights. On the other hand, it might also be sufficient to just look at the code.