Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


is Apache+mod_php on Windows “great” for long polling PHP apps?
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.

is Apache+mod_php on Windows “great” for long polling PHP apps?

sandrosandro Member
edited May 2012 in General

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.

  • sandrosandro Member

    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.

  • MrAndroidMrAndroid Member
    edited May 2012

    @sandro said: 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

    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).

  • gbshousegbshouse Member, Host Rep

    @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).

  • sandrosandro Member

    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?

  • @sandro said: 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.

  • sandrosandro Member

    Ok then add "when you have just 512MB of RAM".

  • @sandro said: 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.

  • gbshousegbshouse Member, Host Rep

    Maybe you should do some PHP tuning or if the website is very busy create simple HA scenario

  • sandrosandro Member

    @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 ...

  • sandrosandro Member

    So I can forget about PHP?

  • gbshousegbshouse Member, Host Rep

    yop :)

  • sandrosandro Member

    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"

  • gbshousegbshouse Member, Host Rep

    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

Sign In or Register to comment.