V
V
Vladislav Orlov2019-04-30 00:32:32
MySQL
Vladislav Orlov, 2019-04-30 00:32:32

How to display data so that the database does not lie down?

Hello!
A question of the following nature - Let's
say there is a small online store where there is a catalog.
Each of the goods - is unloaded from the database.
That is, we send a SELECT request, and we already substitute the data in PHP and display beautiful product cards with information on them. Everything would be cool and great, but there is one thing but ..
After all, every time a user refreshes a page or goes to some of the pages of the site, a request will be made to the database from where the data will be pulled. And this is a load.
It's good if there are 5 users. And what if there are at least 100 users, and everyone completes the request in one second.
How not to lay down the base and make everything work well.
Please tell me which way to dig and what to study.
At the moment I use the minimum Beget hosting plan, it has MYSQL. But something tells me that such hosting will not be enough for a long time. How to choose where to store the database and whether it is safe to store the login data for it in the PHP file itself.
Thanks in advance for your reply!

Answer the question

In order to leave comments, you need to log in

4 answer(s)
O
Oleg, 2019-04-30
@402d

Storyteller. 100 hits per second for a small site.
1 hit in 100 seconds for 2 years is more likely.
And after a year of working with databases, you will blush at your question.
Muska easily holds
15 thousand requests per second of the type to select by id.
Selections from lists depend on the quality of the indexes.
It takes an average of 15 requests to display a normal page.
Don't worry ahead of time. With experience, you will understand when to make one request a couple of megabytes long,
and when it is faster to make 10-100 pieces instead of one.

I
Ivan Shumov, 2019-04-30
@inoise

Once again, a person on the site has one and a half diggers, and he begins to pronounce the word load. That's when you notice that the server starts to go dumb, and requests are executed slowly, then you will panic

R
Roman Mirilaczvili, 2019-04-30
@2ord

If it is used in a query, then it is bad practice, since the number of records is not limited. And when there are a lot of them, it starts to affect performance. In general, you need to analyze Slow queries. To find out the load on Mysql, you can connect to the database using Mysql Workbench in the menu on the left, select Server status and monitor the load in real time. In general, it is too early to ring the bells while there are no specific figures.

B
BasiC2k, 2019-04-30
@BasiC2k

The source from the principle that the user does not need to see 100,000 records at once. Load them dynamically, as needed, or if needed immediately - as a separate report.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question