1b.app
Link copied -

Suggestions for optimizing cron work

I ran into a problem that after the launch of mass changes, the task fell into a minute cron and paralyzed the work for 2.5 hours.
Sentence:
1. Actions started manually should not stop the execution of automatic actions. I assume that the solution will be to create a separate cron for manual tasks.
2. In my case, I started resaving 120,000 contact cards. For 1.5 hours, not a single card has changed, but the cron freezes and it was possible to solve the problem only with the help of your help. I consider it simply necessary to create at least an accepting task dispatcher, where you can manually kill a hung or too long process without the help of a developer.
3. When performing a large number of tasks in the process of execution, it is clear that some of the cards or processes have already changed, and some are still in the queue. When p1 is performed, even long-term processes will not disrupt the work of vital processes. But, if you run "too many" actions, then the cron hangs,
Original question is available on version: ru

Answers:

1. No, you can’t do this, because if your mass operations simultaneously with the minute crone do something with the same contact, you will get data loss
2. Abrupt cron interruptions - this will also be a problem, since you obviously do not understand whether it is working now or just waiting
3. it all depends on how much memory you allocated to crons, you can give so much memory that they are enough to process 200K records
24.02.2021, 14:58
Original comment available on version: ru

Thanks Igor.
Now I have launched a mass action to change the stage for 5500 processes. After a couple of minutes, I see that 500 processes have already changed the stage, the rest are still waiting in line. I see that the process is underway.
When starting a mass change of 120,000 customer cards in 1.5 hours, not a single card was changed. Cron just stopped.
Therefore, I dare to conclude that sometimes it's not about waiting, but about failure due to a large number of tasks. From this situation, you need to provide a way out. Make an auto-check and restart if it freezes (if you reject a manual restart. Or make protection that would not allow exceeding the capacity limit.
And so I do a standard operation and get a freeze. Looks like a bug.
3. Is memory allocation done by you? Or is it about the server's shared memory? How much is allocated now?
24.02.2021, 18:22
Original comment available on version: ru

By the way, I launched in 5500 processes I changed the stage. At the stage, I send a message to the viber bot.
The procedure took an hour. Minute kroner hangs all this time. It turns out that during working hours I can’t make a newsletter, because the rest of the processes will stop. I agree that you do not know the features of the system, so my suggestions may be incorrect. But I see a problem. What solution do you see? Changing resources? After all, clients can be with big tasks?
24.02.2021, 18:53
Original comment available on version: ru


Ptashkin Sergey
Client wrote:
Therefore, I dare to conclude that sometimes it's not about waiting, but about failure due to a large number of tasks. From this situation, you need to provide a way out. Make an auto-check and restart if it freezes (if you reject a manual restart. Or make protection that would not allow exceeding the capacity limit.

restarts and checks are done by the server settings and not by the system, the system cannot understand the cron is running or has crashed from memory. Memory throttling is also on the server side.

Ptashkin Sergey
Client wrote:
And so I do a standard operation and get a freeze. Looks like a bug.

I described to you the reason why this happens, since the system is installed on different servers with different capacities, then I have no right to limit the number of data sent to cron

Ptashkin Sergey
Client wrote:
3. Is memory allocation done by you? Or is it about the server's shared memory? How much is allocated now?

Memory (memory_limit) is allocated on the server for php scripts, configured by the system administrator, in this case you have 512 megabytes to run a minute cron

Ptashkin Sergey
Client wrote:
By the way, I launched in 5500 processes I changed the stage. At the stage, I send a message to the viber bot.
The procedure took an hour. Minute kroner hangs all this time. It turns out that during working hours I can’t make a newsletter, because the rest of the processes will stop. I agree that you do not know the features of the system, so my suggestions may be incorrect. But I see a problem. What solution do you see? Changing resources? After all, clients can be with big tasks?

the solution here is just increasing the memory
25.02.2021, 14:21
Original comment available on version: ru

[/quote]
the solution here is just increasing the memory
[/quote]
Thank you. Changed to 4 GB. Trying
01.03.2021, 14:59
Original comment available on version: ru

Igor, we could not cope with the task on our own, I ask for your help.
Yesterday changed in the php.ini file
memory_limit = 512M to memory_limit = 4096M then restart Apache
After that, the minute cron runs tasks for 2 minutes. This morning the php.ini file was empty. And you said we made a mistake.
Today the file was restored and everything worked. Changed again and the problem reappeared.
Igor, I do not insist that you do our training. We are ready to entrust this task to professionals. You can evaluate this task and we will pay for it. Thanks
02.03.2021, 14:58
Original comment available on version: ru


Ptashkin Sergey
Client wrote:
Igor, we could not cope with the task on our own, I ask for your help.
Yesterday changed in the php.ini file
memory_limit = 512M to memory_limit = 4096M then restart Apache
After that, the minute cron runs tasks for 2 minutes. This morning the php.ini file was empty. And you said we made a mistake.
Today the file was restored and everything worked. Changed again and the problem reappeared.
Igor, I do not insist that you do our training. We are ready to entrust this task to professionals. You can evaluate this task and we will pay for it. Thanks

1h
02.03.2021, 15:06
Original comment available on version: ru

OK. There are 9 hours of improvements on the balance sheet. You can run. If not difficult, write in what we made a mistake.
02.03.2021, 15:14
Original comment available on version: ru

Now the ShopSupplier_Processor_Avail process often hangs in the crown
runs 70 seconds
Haven't seen this before. I don't understand the reason.
02.03.2021, 15:35
Original comment available on version: ru

Good afternoon. Igor, the task is not urgent, but I would like to clarify the deadline in order to understand that the task has not been forgotten. Thanks
04.03.2021, 09:39
Original comment available on version: ru

I also ask for help with free disk space. Give recommendations, please. Do you need to enlarge the disk, or do you need to clean something up?
09.03.2021, 10:42
Original comment available on version: ru


Ptashkin Sergey
Client wrote:
OK. There are 9 hours of improvements on the balance sheet. You can run. If not difficult, write in what we made a mistake.

I registered the settings, wrote off 1 hour

Ptashkin Sergey
Client wrote:
Now the ShopSupplier_Processor_Avail process often hangs in the crown
runs 70 seconds
Haven't seen this before. I don't understand the reason.

this is a recalculation of the availability of goods

Ptashkin Sergey
Client wrote:
I also ask for help with free disk space. Give recommendations, please. Do you need to enlarge the disk, or do you need to clean something up?

I cleaned the logs on the disk and the garbage, the memory was freed
09.03.2021, 14:56
Original comment available on version: ru

Thanks Igor.
Could you suggest a list of work that is recommended to be done on the server with a certain frequency. So that I understand that once a month (or two) it is necessary to pay and carry out a series of service work.
Sending 2000 messages via turbosms. Cron hangs for an hour. The wishes for optimization remain in force so that minute actions do not stop at this time. Maybe you can come up with something else.
12.03.2021, 14:33
Original comment available on version: ru


Ptashkin Sergey
Client wrote:
Thanks Igor.
Could you suggest a list of work that is recommended to be done on the server with a certain frequency. So that I understand that once a month (or two) it is necessary to pay and carry out a series of service work.

once every 3 months it is better to clear the nginx cache

Ptashkin Sergey
Client wrote:
Sending 2000 messages via turbosms. Cron hangs for an hour. The wishes for optimization remain in force so that minute actions do not stop at this time. Maybe you can come up with something else.

it will be from the next version of the system
12.03.2021, 16:11
Original comment available on version: ru

Please join the conversation. If you have something to say - please write a comment. You will need a mobile phone and an SMS code for identification to enter. Log in and comment