The post has been translated automatically. Original language: Russian
One of the most common questions after starting a new project sounds very simple.:
"How much memory should I allocate to the VM?"
There is no universal answer. The same volume may be excessive for a corporate website and insufficient for a database.
Therefore, after some time after launch, it is better not to guess, but to see how the system uses the allocated resources.
There are several signs that are really worth paying attention to.
The first sign is that the memory is almost always fully occupied.
If there is very little free memory left, and the system regularly starts using the swap partition, this is already a reason to figure out the reasons. It is not always necessary to immediately increase the amount of RAM, but you should not ignore this situation.
The second sign is that the response time has increased significantly after the load has increased.
For example, a website runs fast in the morning, but starts to slow down in the afternoon when more visitors arrive. Sometimes the reason turns out to be in the application or database, but lack of memory is also quite common.
The third sign is that the system itself has changed in recent months.
New services have been added.
The database has increased.
Additional modules have been added.
If the VM has started to perform more tasks, its initial configuration may no longer match the actual load.
There is also a reverse situation.
Sometimes the memory is increased immediately after the first signs of slowing down, without checking the rest of the indicators.
In practice, this does not always help.
If the problem is related to a slow disk, an unsuccessful database query, or an error in the application, the extra gigabytes won't change anything.
That is why it is better to make any changes after analyzing the monitoring, rather than feeling it.
Modern cloud platforms allow you to increase the amount of memory quickly enough.
It is much more difficult to determine the moment when it is really necessary.
If you focus not on assumptions, but on the actual performance of the system, the solution usually turns out to be much more accurate.
Когда в работу сайта вносят изменения, большинство владельцев ожидают, что проблема проявится сразу. Если сайт открылся, формы работают, а пользователи не жалуются, кажется, что все прошло успешно.
На практике многие ошибки ведут себя иначе.
Они становятся заметны не через минуту, а через несколько часов или даже на следующий день.
Почему так происходит
Некоторые функции используются не всеми посетителями.
Кто-то не заходит в личный кабинет каждый день. Кто-то оформляет заказ только вечером. Кто-то впервые за неделю отправляет заявку через форму обратной связи.
До этого момента проблема может просто оставаться незамеченной.
Что помогает обнаружить такие ситуации
После любых изменений полезно не только проверить главную страницу, но и понаблюдать за проектом некоторое время.
Обратите внимание на несколько простых признаков.
- Продолжают ли приходить заявки с сайта.
- Нет ли резкого снижения количества заказов или обращений.
- Не появились ли новые сообщения об ошибках в журнале приложения.
- Не увеличилось ли количество обращений в поддержку.
Иногда именно эти косвенные признаки позволяют заметить проблему раньше, чем она станет массовой.
Почему это полезная привычка
Многие изменения проходят без каких-либо последствий.
Но если после обновления выделить несколько минут на наблюдение за работой сайта, вероятность неприятных сюрпризов заметно снижается.
Такой подход не требует специальных инструментов и постепенно становится обычной частью эксплуатации проекта.
Вместо вывода
Проверка после изменений не заканчивается в тот момент, когда сайт снова открылся.
Иногда самая полезная проверка — это внимательно посмотреть, как проект работает в течение следующих нескольких часов. Именно в это время часто проявляются ошибки, которые невозможно заметить сразу.