I don't believe there is any way to add a pool without restarting/reloading (as per this).
I do think that redundancy is the best approach to this, I do believe, that you might accomplish what you want with reload
. Since it is a graceful reload it should wait for the processes to finish.
Essentially, pass the SIGUSR2
signal to php-fpm, and it will gracefully reload all workers + reload the fpm conf/binary.
I believe that amounts to
kill -USR2 `cat $php_fpm_PID`
So, you modify the conf - and reload - shouldn't result in noticeable downtime.
Another option is to run one process per user - you can add new users without terminating existing processes, but the resource requirements are significantly higher (and, for 1000+ users aren't likely to be practical).
One more option is to create a temporary php-cgi process for the new user, and delay reloading the server until later (i.e. low load period, or when you have multiple users to add). This would reduce downtime, but still bring up the new user's subdomain immediately.
None of the above are exactly ideal, and the only practical solution to no downtime would be the multiple server approach.
I'm starting also a new adventure with very similar setup and we share similar concerns about it. Let's talk more ;)
I'll try to answer avoiding new questions, but not guaranteed:
- I think, need to try, it can be done similar on when you update on a regular IIS deployment scenario. Understanding ASP.NET Dynamic Compilation can help to get more into this. Updates side-effects can always be minimized and all depends on your needs.
- It's possible to have several fastcgi-mono-server instances running, still investigating some details dough, listening on different internal ports. I've managed to do this but require more testing.
Other 2 questions...
I also haven't find to many news and documentation on the subject but I'm using fastcgi-mono-server, fastcgi-mono-server2 and fastcgi-mono-server4 without any problems and, as you, I have mono 2.10.5. Consider yourself as an adventurer on asp.net+mono world. I'll try to blog more about my findings to contribute with a more broader discussion.
AFAIK fastcgi-mono-server does not need to run as privileged user, that is root access should not be needed. I'me also investigating more about on security level because at deployment level/running my apps right now I feel I'v reached a stable solution.
Hope this can bring some light to your doubt's... and mine.
Best Answer
The 'only' way would be to:
NGINX can forward connections toward a pool of fastCGI mono server. You can execute different fastcgi process for each of the website/application and modify you NGINX configuration to point to each of the application depending on the vhost or URL. Adding new sites will only requires a NGINX reload - which will NOT reload the whole mono server, only the NGINX internal forwarding rules.
Additional configuration examples can be found there: http://www.mono-project.com/FastCGI_Nginx
For reference sake, I'm posting the main part: Nginx configuration (as of version 0.7.63) is located in /etc/nginx/nginx.conf (which contains http configuration) and in /etc/nginx/sites-available/default (where is configuration of particular virtual host or hosts). In order to setup ASP.NET or ASP.NET MVC web application, you need to modify virtual host configuration.
NGINX vhost configuration bloc. This forward to a fastcgi process running on port 9000 of the same system. You could be using 9001 for the second apps, etc. You could also be using dedicated servers to run your application, in such case, NGINX becomes a pseudo HTTP load balancer.
and you control individual mono 'application' with:
Note: Answer edited a few times to provide additional and a more precise solution.