Activity Stream
48,167 MEMBERS
63324 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 4 of 4
  1.     
    #1
    Member
    Website's:
    maxneeds.info

    Post PHP vs AJAX requests and speed question..

    Hi guys.
    I am here with an interesting question.. I will try to explain briefly.

    For example you have left,middle and right section in your website. Each of them must show content in different files on your server (for example 1.txt,2.txt and 3.txt).The txt files are 512kb each.
    In my case i have to do an ajax request to a php file that gets and echoes (so the ajax can take the result ofc) the content from the txt files.

    So should i do 3 ajax requests(for each section) to the php file or do just 1 ajax request and then split the result in 3 parts with some separator for example.

    What would be faster ? What would save more CPU usage too?

    Thanks
    Porsche_maniak Reviewed by Porsche_maniak on . PHP vs AJAX requests and speed question.. Hi guys. I am here with an interesting question.. I will try to explain briefly. For example you have left,middle and right section in your website. Each of them must show content in different files on your server (for example 1.txt,2.txt and 3.txt).The txt files are 512kb each. In my case i have to do an ajax request to a php file that gets and echoes (so the ajax can take the result ofc) the content from the txt files. So should i do 3 ajax requests(for each section) to the php file Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    I'd say a single request would be definitely faster. CSS sprites are popular for the same reason - combining multiple requests into a single one.

    And I don't think you have to worry about CPU usage for such a simple script.

  4.     
    #3
    Member
    Website's:
    maxneeds.info
    @deliteblogger this is just example. The script will be much more complicated.
    The thing is that i can complicate it as much as i want (meaning to download more variable data and show it with single ajax request)
    so i was wondering if i should not complicate it so much and just do more ajax requests instead.

  5.     
    #4
    Member
    Depending on the txt1,txt2, etc file size, i would say use 3 Ajax requests would be better than splitting the text...In terms of CPU usage. Might be wrong, but splitting heavy amounts of texts causes CPU usage to go up quite a bit. Or at least happened in my case, whereas when i used ajax requests didn't seem to be too bad.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Question about VPS-speed
    By Szabortusz in forum Hosting Discussion
    Replies: 1
    Last Post: 28th Aug 2011, 06:58 AM
  2. Ajax googleapis
    By killer123 in forum Webmaster Discussion
    Replies: 2
    Last Post: 22nd Feb 2011, 11:35 AM
  3. Ajax Load
    By Daniel in forum Useful Sites
    Replies: 5
    Last Post: 1st Jun 2010, 04:29 PM
  4. Help with CSS (and maybe PHP/MySQL/Ajax)
    By Sefyu in forum General Discussion
    Replies: 5
    Last Post: 8th Mar 2010, 10:54 PM
  5. AJAX IM
    By bloodqman in forum Technical Help Desk Support
    Replies: 0
    Last Post: 7th Dec 2009, 07:24 PM

Tags for this Thread

BE SOCIAL