#Handle Multiple clients in production env AWS Ubuntu

17 messages · Page 1 of 1 (latest)

short kettle
#

Hi friends! im working out in a project with this lib, we actually have some stable version with the main features we need, we're using local auth to keep sessions, and for example when we restart the server for any reason, update, etc, with a for each i search all the clients in DB that were active and restore it session the clients are stored in a clients = {} object, also the clientId is stored in mongo and they have a clientActive boolean field to verify if we need to reinitialize or not.

Now the problem is when we try to reinitialize existing clients, more than 11 clients at the same time the server crash, the server is on AWS on ubuntu, and the aim is to reach at least 500 clients at the same time sending and receiving messages.

the question is, anyone have some similar situation? i mean handling multiple clients at the same time? or maybe initializing a lot of clients at the same time?

We have some ideas like having in the production environment, lots of AWS instances like 10 - 20 wwebjs clients per instance, but before taking this decision i would like to have some refs about this issue

Sorry for the long book but I think that, despite the problem, it is an interesting topic on how that would be handled.

sharp marsh
#

What are the logs when it crashes? How much memory has your service?

sterile blade
#

I too have the same issue.
Right now I'm on ec2 t2.micro server

I want to know how many clients I can handle with 1cpu and 1gb ram in ubuntu.

Please explain with examples if possible

short kettle
#

anyways if with 4gig crashes only with 10 clients, to handle 500 clients, for sure the solution is not upgrading memory, we think about like farms of servers per 10 clients for example, or in the worst scenario migrate to another WS lib

short kettle
#

with 4gb we actually can handle 10 clientes more or less, without compromising the server

sterile blade
short kettle
#

Yes you'r right! different things

#

but think about this, imagine we have 500 clients consuming our service and we need to update some feature in server, all clients need to be reinitialized. and yes we can initialize it like 5 clients at the same time until we reach 500 but it sounds a not efficient solution

#

and to test how much clients active the 4gb server can handle we have to test with real users, i am right? because i cant imagine any way to performance test without real wpp accounts

sterile blade
#

Yess . We need real WhatsApp numbers to test the max number of clients 1gb ram can handle . So that we can have a benchmark.

For that we need an opinion from someone who is already running with multiple clients .

If someone in the community could help us out for that . That would be amazing

sharp marsh
#

My app is running on Beta, I have ~4 instances running on a 1gb memory. instance
I as able to run 9 instances with 2gb
I could try more (my app is easy to scale and to add new numbers) but I don't have more numbers

sterile blade
#

@sharp marsh so you saying we can run maximum 4 instances on 1gb ?

sharp marsh
#

On average, yes. You can probably get a few more, but chrome isn't pretty good on freeing memory, after some time you get OOM

sterile blade
#

So this is not cost effective
There is a Fixed Cost for 5 clients.

So basically who ever is running a server on this lib and has 500 clients, he would definitely have a huge server
Correct?

short kettle
#

hi everyone! i think the avg scenario is like floows says, much memory consuming and need to handle the problem based on resources or multiple srv instances