New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
is Apache+mod_php on Windows “great” for long polling PHP apps?
Considering Apache on Windows is a threated process wouldn't be OK to use a Windows hosting and use that configuration without using other servers like node.js?
I performed a test and with 100 concurrent connections the RAM raised to just 80MB TOTAL, imagine that on Linux where 100 processes must be started...
Comments
You do know Linux/UNIX runs PHP better over all? PHP is multi-threaded on *NIX, which is why it creates more processes, but you get a major performance boost and can handle more visitors.
So no, PHP is not good on Windows for running PHP apps.
Hi,
yes of course I know but I'm referring to the memory issue only when running scripts that take a long time to end. On Windows due to that you don't need to start another process for every request.
Imagine a web app that scans some other sites continuously controlled by the browser via AJAX (calling PHP scripts), on Windows you can have 100 users using the site at same time using a very low amount of RAM, on Linux you would have to start 100 PHP servers and basically run out of memory (unless you have $ to buy RAM ) and the 101rd user will not have access to the site because all the PHP processes are used (even if the PHP script involved has just a > sleep function).
Again I'm talking about this particular case of application and RAM:$ relation.
Do remember Linux uses 1/10th of the RAM that Windows uses, and you don't have to pay for licenses so it would be cheaper..
You can disable how many PHP spawns you have (e.g. php-cgi).
@sandro - if you want to use long pooling on Windows forget about PHP and Apache with both sucks on Windows Server. Instead of it use Windows Server + .NET + SignalR + jQuery. You can create client front-end with PHP and jQuery on Unix/Linux and run polling server(s) in the background or use cloud for ex. Azure (there are nice tools for PHP/Azure integration).
Hi,
I don't want to use Windows at all I was just asking because I was shocked that my PHP site was unreachable when I was just doing simple tests because all PHP processes were used.
What could it be the easier way to do it on Linux considering I know PHP and JS and I use niginx + php-cgi?
nginx + php-cgi is fine.
Ok then add "when you have just 512MB of RAM".
nginx + php-cgi can run on 128MB of RAM.
Play around with the child process limit.
Maybe you should do some PHP tuning or if the website is very busy create simple HA scenario
@Daniel Try to do an ab benchmark starting around 15 children with a file with > sleep(10); and 100 concurrent connections, you'll see that the server will only be able to serve 15 users at once and no one else will be able to access.
@gbshouse it's not a tuning problem its how the script works and even if it lasted 5 seconds per request it's launched continuously. So maybe PHP is not the way to go ...
Few tips
http://www.brentsowers.com/2011/06/http-long-polling-aka-comet-with-nginx.html
http://timanovsky.wordpress.com/2009/01/09/toward-a-million-user-long-poll-http-application-nginx-erlang-mochiweb/
So I can forget about PHP?
yop
how is that OK? I mean can nodeJS do all the things PHP can? What happens to all the security measures and classes you write for the all website? It seems so stressful and not convenient to have to rewrite all your code and keep it "synced"
Answer is simply - PHP sucks just kidding. Just dive into types of programming languages, how they are compiled, check how "big players" solve the issues. For example for .NET you can host SignalR within main web app so you can share all stuff. If you need PHP based solution write a daemon with public endpoint and call it from jQuery or whatever