Answer the question
In order to leave comments, you need to log in
How to solve load problems, or how to calculate character. VPS?
Good afternoon.
I had an order for the development of one project.
Also in this project, I wrote an API for a mobile application.
API allows you to register users, authorize them, and get information about the user.
The project is very closely tied to CRM Rkeeper.
I will describe one process, the registration process.
The mobile application sends a request for user registration, the web server in turn:
1. Validates the data
2. Creates a row in the database (in the users table)
3. Sends an email to confirm email
4. Calls CRM via API - searches for the user by email
-- If yes, it synchronizes site data with CRM
-- If not, then creates this user in CRM and synchronizes the data.
5. Contacts CRM via API and creates a loyalty card
. All this is done synchronously and without queues.
The client did load testing and started complaining that everything was bad.
We started 50 threads at the same time and gave the following result in ms:
Registration:42512,4408
Registration:37837,6567
Registration:40158,8063
Registration:41586,602
Registration:43232,8989
-------------- -----------
Registration:43027,9108
Registration:31010,2805
Registration:37531,425
Registration:34658,028
Registration:59004,4044
I developed only the backend part on Laravel. I didn't do the deployment. I'm not DevOps and I don't understand anything about it.
The client chose a hoster - https://hostpro.ua/
VPS characteristics:
* CPU - 2 cores x 2.2 Ghz
* Memory - 2Gb
* HDD - 30 gb
They put nginx + mysql + php7.2 there
In general, they accuse me, and I don’t even know what answer them.
If I register myself, then the whole process takes 3-5 seconds.
I don't even know how to stress.
What do you think ? Where can there be problems? Maybe a weak or bad VPS? Or maybe the web server is poorly configured?
Obviously, there are a lot of requests in CRM, which for good would be thrown into the queue. But this cannot be done, because in response to the registration request, the application must already receive a loyalty card number.
I will be glad to any advice.
Answer the question
In order to leave comments, you need to log in
yes in profiling everything will be visible. fasten xhprof, run 50 threads again and see what's stupid. why guess when there is a great tool. here is an example
VDS needs to be tested. What is written in the tariff may differ in reality at times.
You can do a simple trace using xdebug.
At the beginning of the script, we add, right at the beginning of the Laravel index.php in the public folder (make a copy of index.php for peace of mind):
<?php
if (!file_exists(dirname(__DIR__)."/xdebug")) {
mkdir(dirname(__DIR__)."/xdebug");
}
xdebug_start_trace(dirname(__DIR__)."/xdebug/".rand(1,10000));
...
0.4393 81359120 -> drupal_alter() /Users/mike/projects/unicorns/includes/menu.inc:508
0.4395 81359264 -> is_array() /Users/mike/projects/unicorns/includes/module.inc:1000
0.4398 81359624 -> module_implements() /Users/mike/projects/unicorns/includes/module.inc:1021
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question