YunoHost-Apps / lutim_ynh

Lutim package for YunoHost
https://lut.im
GNU General Public License v3.0
5 stars 7 forks source link

Decrease the number of workers #38

Closed supermamie closed 4 years ago

supermamie commented 5 years ago

In conf/lutim.conf.template the number of hypnotoad workers not set (so I think the default value is 4, or 10 ?).

As said in https://github.com/YunoHost-Apps/lufi_ynh/issues/28 I think it is still too much for YunoHost.

I suggest to set it down to 2 with a description in the project/admin page so users can set it up if needed.

maniackcrudelis commented 5 years ago

Hi

To set it low could be good for a small device, not a for a big one. What does the documentation says? Where did you find it? Would be better to set this value according to the device lutim is install on.

supermamie commented 5 years ago

I asked advice to the lutim main dev : https://mastodon.roflcopter.fr/@Mamie/102580467318476195 The doc is there : https://mojolicious.org/perldoc/Mojo/Server/Hypnotoad#workers

Number of worker processes, defaults to the value of "workers" in Mojo::Server::Prefork. A good rule of thumb is two worker processes per CPU core for applications that perform mostly non-blocking operations, blocking operations often require more and benefit from decreasing concurrency with "clients" (often as low as 1). Note that during zero downtime software upgrades there will be twice as many workers active for a short amount of time.

The main problem I found was the system load that decreased greatly after I reduced the number of workers (especially in lufi where it was set to 30)

ldidry commented 5 years ago

As you quoted:

blocking operations often require more and benefit from decreasing concurrency with "clients" (often as low as 1)

That’s why I set 30 workers, 1 clients for Lufi as default, but obviously, for family usage, the workers can be more less.

maniackcrudelis commented 5 years ago

@ldidry, According to the documentation that says 2 workers par CPU core. What would you recommend for Lutim and Lufi ? Considering that we'll know how many CPU core we can count on. nproc will give us that information.

ldidry commented 5 years ago

I would say, for lutim, use 2 workers per CPU core, for Lufi, use more if the instance will have a lot of users, otherwise, 2 workers per CPU core.

You may want to have a checkbox at install asking if Lufi will be heavily used. For Framadrop, we have 150 workers. We have ±1500 users per day.

supermamie commented 5 years ago

Please keep in mind that more workers = more server load (even when lufi/lutim is not used at all) Does "2 workers per CPU core" means "cpu core of the device" or "cpu core used for lufi/lutim" ?

ldidry commented 5 years ago

Per cpu core of the device.