SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    286
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can I make my app fast...??

    Hi.

    How can I make my app fast and it should be able to bear 50,000+ hits per day!
    Need to know main points to achieve this goal...


    /***********************************************/

    Sometimes, an application is working fine. Bust as the load increase on the application i.e. the number of users accessing the site increases upto several thousands per day, it crashes....

    What are the reasons for such crashes....
    [COLOR=SlateGray]
    Web Developer @ VeriQual

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The basic recipe is this: 1) Write the program so it does what it should do. 2) Put it under stress and measure where the slow parts are. 3) Apply optimisation to these places. 4) Measure again and see if the optimisation worked. 5) Test that the application still works. 6) Repeat from 2.

    To help with 2, you can use apache-bench, xdebug and either kCacheGrind or WinCacheGrind (If you use Windows, the latter is probably easier).

    To help with 1 + 5, you can use unit-testing.

  3. #3
    SitePoint Addict Jasper Bekkers's Avatar
    Join Date
    May 2007
    Location
    The Netherlands
    Posts
    282
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    “Almost all programming can be viewed as an exercise in caching.” - Terje Mathisen

    This is even more so for performance related problems.
    Design patterns: trying to do Smalltalk in Java.
    I blog too, you know.

  4. #4
    SitePoint Addict
    Join Date
    Jan 2008
    Posts
    203
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    install php APC extension, 50,000 hits is nothing

  5. #5
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ionix5891 View Post
    install php APC extension, 50,000 hits is nothing
    Not a bad idea!

  6. #6
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    286
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ionix5891 View Post
    install php APC extension, 50,000 hits is nothing

    Wots PHP APC,??

    Where can I get this..
    [COLOR=SlateGray]
    Web Developer @ VeriQual

  7. #7
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  8. #8
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, instead of installing APC without a second thought, I would recommend first following the Kyber's instructions to to pinpoint the exact bottlenecks that are slowing down your application. A cache system like APC can solve only a certain type of bottleneck and that bottleneck may or may not exist in your application. it could be faulty or weak hardware, inefficient or redundant queries, anything...

  9. #9
    SitePoint Addict
    Join Date
    Jan 2008
    Posts
    203
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ^^ i concur

    if your code is rubbish to begin with APC wont help much but it is the easiest optimization to add, also make sure you have the very latest php version and i also when compiling php ensure extensions i know i wont use are not compiled/configured

  10. #10
    SitePoint Wizard HarryR's Avatar
    Join Date
    Dec 2004
    Location
    London, UK
    Posts
    1,376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken View Post
    To help with 2, you can use apache-bench, xdebug and either kCacheGrind or WinCacheGrind (If you use Windows, the latter is probably easier).
    I can highly recommend xdebug + kcachegrind, I usually leave xdebug dumping profiling data for the whole site into a single file, then towards the end of the week load it up in kcachegrind and review the various different measurements, graphs etc..

  11. #11
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by HarryR View Post
    I can highly recommend xdebug + kcachegrind, I usually leave xdebug dumping profiling data for the whole site into a single file, then towards the end of the week load it up in kcachegrind and review the various different measurements, graphs etc..
    You run a profiler on your production site? I wouldn't recommend that practise; It takes a lot of performance, not to mention disk space.

  12. #12
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This has been my experience:

    1) Determine which pages get the majority of requests - start optimizing those ones first (server logs, analytics stats etc.)
    2) Cache, cache, cache!!
    3) Optimize database related stuff - slow queries, indexes, table types etc.
    4) Server infrastructure configuration - httpd.conf, my.conf etc.
    5) Server infrastructure hardware - once you've exhausted the above, you will have to look at your actual server hardware. eg. go from virtual to dedicated host, upgrade to more powerful server hardware, migrate to a multi-server environment etc.
    6) Sandboxing application functionality onto different servers. Eg. if your app has a high db load and serves a lot of images, move image serving to a separate server (images.yourapp.com) and move the database to it's own separate db or replicated across different machines etc.

    #5 and #6 are usually a last resort once you've squeezed as much as you can out of the other items.

  13. #13
    SitePoint Addict
    Join Date
    Apr 2004
    Location
    Melbourne
    Posts
    362
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken View Post
    You run a profiler on your production site? I wouldn't recommend that practise; It takes a lot of performance, not to mention disk space.
    I wouldn't recommend it as a standard practise, but sometimes there's no alternative due to usage patterns that might only affect that particular instance, so doing something like this for a few days can be worth the pain.

  14. #14
    monitormensch oerdec's Avatar
    Join Date
    Sep 2004
    Location
    Hamburg
    Posts
    706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some cache techniques:

    Browser site: Once a file is downloaded it remains in the browser cache until a newer version is available on the server. It can be achieved by sending the correct HTTP headers.

    Server site: Save the output in a file. When the URL is requested the second time, deliver the cached file. In this way there's almost now work for PHP to do and database queries could be avoided. It it also possible to save a serialized object in a file.

    Database: Cache the queries and the results. See MySQL query cache for example.

  15. #15
    SitePoint Wizard HarryR's Avatar
    Join Date
    Dec 2004
    Location
    London, UK
    Posts
    1,376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken View Post
    You run a profiler on your production site? I wouldn't recommend that practise; It takes a lot of performance, not to mention disk space.
    No, just in the development environment and for unit tests so I can get better in-depth measurements of overall performance rather than just guessing.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •