WebIM2014-07-30 03:45:42
WebIM, 2014-07-30 03:45:42

$.ajax and .load() with a large number of visitors - really?

Guys, tell me please. Organized site navigation (+ monitoring of pressing "Back", "Forward" buttons) by means of ajax( $.ajax, .load() ).
The question is this - will it not load the server on which the site is located? I am very sorry that I did not have the mind to ask about this when the site is almost ready. Yes, and I spent a lot of time organizing the work of this whole scheme. The site with ajax
works very fast, hence the number of requests will increase (of course, you can add a delay before each request in the form of a loader)
the answer was always possible to get without error).
Thank you for your time. And finally - if everything is so bad, how to deal with it? (there is no time for a rewrite other than minimizing js or ajax impact on server load, or if possible, replacing them with similar methods in short lines).

* A large number of visitors - 100-200 per day, 50% of which will use not only the function of simply viewing the content of the site ( send messages, comment on posts, create topics, attach photos ... )

Answer the question

In order to leave comments, you need to log in

7 answer(s)
Dmitry Entelis, 2014-07-30

The average number of requests on the web is from 1000 per second per 1 server :)
Ajax, from experience, reduces the load on the server by saving traffic => requests are sent more quickly.
You are busy plugging holes, instead of understanding the root cause.
If you sometimes get an error when requesting, something is fatally wrong with you.
See server error log, php_errors etc.
Perhaps you have a very [sarcasm]expensive[/sarcasm] tariff for a hoster and sometimes there is not enough memory / processor / something else.

Sergey, 2014-07-30

100-200 visitors per day is not a load. Understand server performance and why 501, 504, 404 occur?
For example:
404 is clearly a bad url, php is not getting it
504 is clearly php performance, increase the wait timeout on the server (for starters).

podvzbzdnul, 2014-07-30

It is possible to store the history of movements locally using js, and send it to the server when the site is closed.

barkalov, 2014-07-30

The server will be "loaded" in proportion to the number of received requests. If for a static site the average session was, say, 10 requests, and the dynamic one turned out to be 40 requests, then the server will be a maximum four times harder, no more. And given the savings on traffic, it may turn out that it will even be easier for the server in the end.
$.ajax itself is not terrible (if it is cached normally), the problem is that you get errors where they should not be (a crutch in the form of a second attempt to load is not a solution to the problem) In the meantime, you have unexplained errors -or foresee, maybe three people will be dropped.

mind3, 2014-07-30

And how the request to the server is formed via ajax, I feel something asynchronously in another place does not have time to be processed and the request to the server of the curve goes away or the parameters are rewritten in js. Use Console.log() to track how query parameters change. For 404 is the server's response that such a page does not exist, but 504 apparently climbs out due to the fact that the pohapa does not have time to process and give the server the information during the time when the server should return it.

WebIM, 2014-07-30

Thanks guys for the replies.
At the expense of errors - the site is on a free hostinger plan (I put it there for the test). Errors occur when a php function is executed, the $("#pageid").load("/pages/page.php?param=1");
normal side, ala

   if($Class->GetData(Somedata) )

I do not see where it is possible to look at the hostinger'e error log. Chrome only shows in the log that the error status is 500 (Internal server error )
Thanks again to everyone for the answers.

namit, 2014-08-10

In Yandex Metrica there is something like a subscription to events - this is probably what you need. help.yandex.ru/metrika/objects/reachgoal.xml
At least it will unload your server from this routine. You can send anything there, and it will be logged in the metric.
Just hang yaCounterXXXXXX.reachGoal() with the parameters you need on the buttons you need and voila.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question