ComboStrap / site-com-combostrap

ComboStrap - Website publishing made easy with DokuWiki
https://combostrap.com
5 stars 2 forks source link

Site reports "no available server" #6

Closed lispstudent closed 2 weeks ago

lispstudent commented 2 weeks ago

Hello,

At the moment the site https://combostrap.com/ reports

no available server

20240909 _071207-screenshot 2@2x

gerardnico commented 2 weeks ago

Thanks.

Yes that's possible.

The server restart automatically when there is no enough memory available due to image processing.

Php loads the image in memory and when there is too much image asked, there is no memory left.

I tried hard to fight this problem even with a script that would kill the image processing but it didn't work.

For now, the whole server is automatically restarted.

Thanks for the feedback!

gerardnico commented 2 weeks ago

To be clear it happens rarely.

It's pike where I don't have any control over it.

For now, I have no idea how on earth I could give to image processing only 2 threads within php fpm.

lispstudent commented 2 weeks ago

Thank you for the explanation, very instructive.

PS: I cannot offer much, beside considering looking into another OS. Linux is renowned for being merciless in low memory situations, unleashing the OOM killer way too much.

At the University where I study, they use FreeBSD, more lenient in those aspects.

gerardnico commented 2 weeks ago

It's much more like a DDOS attack. Too much visitors (or bots) and boum ...

I could pay to increase the memory but it will not resolve the problem entirely.

Normally, you would queue the image processing but as of now, I have no idea how you can do that.

Most site serves also images from another server so that they don't get in the way of serving pages.

Php creates a process for each request and a page creates between 5 and 20 requests. It adds up pretty quickly.

All the best !!!

lispstudent commented 2 weeks ago

Thank you.

If I understand correctly, that could be an issue due to php/php-fpm settings. You probably already saw resources such as this.

In case of ddos, a way worth considering would be anti-ddos measures, which usually is implemented on the hosting company side, i.e. this.

I will keep an eye on this issue.

Many thanks for the wonderful Combo plugin, and your help on the DokuWiki forums. Your work is truly making a big difference.

All the best to you!

gerardnico commented 2 weeks ago

Yeah the solution is in the php-fpm configuration.

They have the notion of pool where you can configure the number of thread.

As for now, I have only one pool https://github.com/ComboStrap/dokuwiki-docker/blob/main/resources/conf/php-fpm/www.conf

In my web server (caddy), I should be able to allocate a minimal pool of 2 children (threads) to the fetch of image. https://github.com/ComboStrap/dokuwiki-docker/blob/main/resources/conf/caddy/Caddyfile

I need to learn how to do that. That's not 1,2,3 because dokuwiki fetches images and other file with the same script (ie fetch.php) so you need to use regular expression.

Thanks for the good words !

gerardnico commented 2 weeks ago

Done.

I have created a dedicated pool for the image: https://github.com/combostrap/dokuwiki-docker/#configure-php-fpm-pool

Commit: https://github.com/ComboStrap/dokuwiki-docker/commit/8d76268c1075dd31e9e03e60329571fe8a63ef31

I have loaded the site with 4 threads of bots and it's still up ...

Thanks for pushing me ...