PHP CURL Performance

Posted on 2006-06-06
Last Modified: 2008-01-09

i'm not sure if this is the right place for this question. sort of fits into two categories

i have a server on which i am running a PHP app. it makes lots of CURL requests off to other sites.
i have setup a second server with the exact same spec as the first server, to do the exact same job. however the CURL requests are considerably slower from the new server than from the old server. in the region of 2 to 5 seconds slower.

anyone got any ideas why? is there a CURL optimisation or diagnostic i can run??

both the servers have the same setup. i recently installed PHPA on the second server. it was already installed on the first server. as far as i can tell PHPA does not support command line PHP apps(like mine). i can confirm that PHPA runs fine on both servers for pages that are served up by apache. can it be configured to cache command line scripts? could this be where the difference is between the two servers??

as you cxan probably tell i am at a loss with this one so any and all help would be appreciated.

Question by:Fatlog
    LVL 11

    Accepted Solution

    If the servers are identical - all I can suggest is that your server could be hooked into a router with a dodgy routing table and its just taking a long time to find the hosts.

    Try running traceroutes from Putty from each server to a standard address - ie. google. or one of the sites you CURL to.
    compare the time and number of hops it makes.
    if they are relatively the same, then it is a server issue, not a network issue.

    Author Comment

    i did up some CURL tests and posted the results to my server provider.

    turns out the server was connected to a 10Mb/s switch by mistake. they switched it to 100mb/s and the response times in my test now match those of my first server.

    thanks for your help!
    LVL 11

    Expert Comment

    Ahh see :)

    Computers are just dumb boxes that do what we tell them...
    If its not working as it should - its either the instruction, or the hardware...
    Since the instruction is the same - must be hardware...

    Cheers mate!
    Glad you got your result!

    - Chris

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to count occurrences of each item in an array.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now