D
D
Don2Quixote2018-04-03 16:26:43
PHP
Don2Quixote, 2018-04-03 16:26:43

How bad is it that 10 - 15 requests can come from each user to the server?

Background music plays on the site page. Presumably, it will accompany the user throughout the use of the site. The user can adjust the volume with the mouse wheel. In this case, each scrolling of the wheel ("mousewheel" event) sends an ajax request to the server to save the volume value in cookies. Thus, each user can send 10-15 requests per second. (See screenshot).

5ac3813ef034f021421246.png

(And now imagine that the user thought about something and at that time began to play around with the wheel, turning it up and down).

Questions:
1. How bad is it?
2. Would it hurt me if I was planning a really big project?
3. How can you optimize the task?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2018-04-03
@Don2Quixote

At the same time, each scrolling of the wheel ("mousewheel" event) sends an ajax request to the server to save the volume value in cookies

Cookies can be saved without Ajax. JS can do it
If you can’t do without Ajax, then you can simply send a request on a timer (say after 1 second), if during this time there was another mousewheel event, we reset the previous timer and start a new one. Thus, requests more than 1 time in 1 second will not be sent.

T
TheLostRoot, 2018-04-04
@TheLostRoot

try storing volume values ​​in localStorage or send to server during page close

P
Puma Thailand, 2018-04-03
@opium

Adjust the volume on the browser side and store in a cookie

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question