Skip to content

Stories from life: "The site is slow"

htop

Ivan Vasilyevich 15:06
Dima, please help us move to a new server. How can we do this with minimal disruption? Our small Intel Atom server is already dying.
Dima 15:08
hello
Ivan Vasilyevich 15:08
Good afternoon! Can we clone it somehow?
Dima 15:09
is it virtual?
Ivan Vasilyevich 15:09
No, physical.
Dima 15:10
and where are we moving to?
Ivan Vasilyevich 15:10
We are preparing a clean Intel Pentium G6950/4GB/1TB server + UNLIM 100 Mbit/s. Please request IP-KVM separately once you are ready to work with the equipment. Please wait for a notification from our technical-service colleagues.
Ivan Vasilyevich 15:10
Yes, there. We simply had the most basic configuration at the Romashka data center for (0000) UAH. Now we are taking this one.
(discussion of server migration approaches and methods omitted)
Dima 15:34
question: why did you decide that your server cannot cope?
Ivan Vasilyevich 15:35
the site is very slow. When there were 30 people on the site, everything was very slow.
Ivan Vasilyevich 15:36
and CPU load jumped to 90%. More than 3,100 users have registered already. It is an Intel Atom.
Dima 15:36
and how long did it stay at 90%? So what if it is an Atom...
Ivan Vasilyevich 15:37
It remained high until people left because of the slowness. It is quite seriously slow.
Dima 15:39
(once again, for myself) how do you substantiate the term "slow"?
Ivan Vasilyevich 15:40
The site takes a very long time to open. Everything used to be instant, and now we wait 3–4 seconds. It kind of lags. People say the same thing.
Dima 15:41
OK, let us look at this differently. You currently have 4 CPU/4 GB and will have 4 CPU/4 GB. Where is the difference?
Dima 15:43
For example, what process is this?
Ivan Vasilyevich 15:44
No idea. Something related to Perl.
Dima 15:44
Second example:
Dima 15:45
it is clearly visible that MySQL consumed the lion's share. The question is WHY? Does it have 1,000,000 queries? How many? Or is the disk subsystem slow? What kind do you have, and what kind are you getting? Will there be a difference?
Ivan Vasilyevich 15:46
It currently has a 250 GB hard drive; we are getting a 1 TB one.
Dima 15:46
or perhaps unindexed queries are pouring in? Have you checked how many? Disk size is NOT related to its speed.
Ivan Vasilyevich 15:47
Intel Atom D510/4GB/250GB -> Intel Pentium G6950/4GB/1TB. I understand.
Dima 15:47
And judging by the amount used, you are far from the limit!
Ivan Vasilyevich 15:47
Our database is causing lag. Yes.
Dima 15:49
I cannot answer your question with this amount of information. I will say this: I believe you have not named factors that require replacing this hardware.
Ivan Vasilyevich 15:50
I understand. The factors are as follows: the site was fast, but when we reached 3,000 users, it became very slow. When 30 people were online, working with the site was practically impossible. I watched CPU load—it was at its maximum.
Dima 15:51
Those are not facts; they are external symptoms.
Ivan Vasilyevich 15:51
I understand that we need to optimize the code, specifically database operation. Apparently, we have a huge number of queries.
Dima 15:51
first we need to understand the cause of the CPU load. No, not "apparently"... where is the evidence?
Ivan Vasilyevich 15:52
Then I give up.)
Dima 15:56
"bang-bang... dead" :)
Ivan Vasilyevich 15:56
Dima, do you have advice for identifying the problem? Working with the site is already uncomfortable. When 30 people are on the site, it is practically impossible. Connect an SSD? Add RAM?
Dima 15:57
Advice: find the cause of the "slowness."
Ivan Vasilyevich 16:26
mysql 85.3 % /usr/sbin/mysqld. Our database really is consuming all resources of the weak Atom.
Dima 16:28
yes, that is clear, but with what?
Dima 16:29
An example that also began with the words "The site is slow": https://note.wdm.net.ua/fromLife/dovecot-gruzit-cpu/
Ivan Vasilyevich 16:31
I am sure this is our case. Is the MySQL cache enabled?
Dima 16:32
nothing is a fact until you check and see it.
Ivan Vasilyevich 16:33
Dima, where do they view database record statistics? There are such nice graphs there. Top shows MySQL took all the resources. We see queries with colossal execution times. How and where can we view all this?
Dima 16:34
Zabbix generates the graphs.
Dima 16:38
in that case, 90% of the slowness was caused by "idiotic" database queries.
Dima 16:40
Use the mytop utility or run SHOW PROCESSLIST in the MySQL client.
Developer 17:00
I read your conversation, reviewed my new queries, and optimized them a little—please check whether the slowness and load have gone away. It seems to work faster visually.
Ivan Vasilyevich 17:00
It has become much faster!
Customer 17:01
and what did you do?
Developer 17:01
the queries were not optimal—several were made instead of one. This happened every time a page was generated for a user. That caused the slowness, and now it is gone.
Ivan Vasilyevich 17:02
The site is flying like Schumacher! We no longer knew what to do. Dima, thank you so much for a sober assessment of the situation. The problem truly was not the configuration.
Dima 21:32
Ivan Vasilyevich, what would you call your role in this project?
Ivan Vasilyevich 21:55
Startup manager.)