Scheduled jobs use all CPUs

This forum is intended for cases when a problem can not be solved due to restrictions of the platform: a bug or lack of functionality.

#1
People who like this:0Yes/0No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

I have found that if a server has several Infobases and every infobase has some scheduled job which runs, for example, ones a minute, it will consume almost all CPU resources and a lot of disk resources probably if not cashed.

It appears that if no user is logged, scheduled job will start complete session, which could take up 10 seconds with high CPU usage. If there are, for example, 10 similar infobases (a group of companies) it tries to run 10 new sessions every minute which consumes all the CPU cores.

What should we do? The job is actually runs at a fraction of a second. We can not merge infobases. We can not buy 10 servers (and do not want to). We need some regular checking of information updates.

1. Could the scheduled job be executed only if there is active user session?
2. Could I use external trigger (web service for example), so only if condition is met scheduled job will run?
3. Is there any way to keep context in memory so not to prepare it for every single job run?

 
#2
People who like this:0Yes/0No
Interested
Rating: 16
Joined: Dec 4, 2017
Company:

Dear Alexey,

Please provide us with further details on the server:

- 1C:Enterprise server version and bitness
- OS name, version, and bitness
- DBMS name, version, and bitness
- (if you use it) web server name, version, and bitness

Best regards,
Vladimir Gurov

1C Company support team
 
#3
People who like this:0Yes/0No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

Vladimir Gurov,
I have the problem described here. https://infostart.ru/public/996126/
As it seems like a "normal behavior", I don{t think version and environment is important. So my question is still how to check some new data without loading context of the Infobase every minute for every Infobase.

 
#4
People who like this:0Yes/0No
Interested
Rating: 16
Joined: Dec 4, 2017
Company:

Dear Alexey,

To view the list of existing calls to your 1C:Enterprise server (including scheduled jobs), use the list of connections to your server cluster.

Indeed, if there are a lot of scheduled job connections and no user connections, it may result in excessive server workload.

If your task is to check certain new data without loading the context of the infobase every minute for every infobase, the reasonable approach to perform the task is as follows:

Create a long-lasting job whose duration is, say, 10 hours and make it perform the required checks. You can set this job to run every 1 minute. When there is a running instance of the job, the system does not run a new instance. Though, once the job instance is over, the system starts a new instance of the job in 1 minute.

This minimizes the resource consumption on loading and releasing the context of the infobase.

Best regards,
Vladimir Gurov

1C Company support team
 
#5
People who like this:0Yes/0No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

Quote
Vladimir Gurov wrote:
Create a long-lasting job whose duration is, say, 10 hours and make it perform the required checks. You can set this job to run every 1 minute. When there is a running instance of the job, the system does not run a new instance. Though, once the job instance is over, the system starts a new instance of the job in 1 minute.

Help me understand here a little more. If I ran a job for 10 hours, how do I put it to sleep to wake up every minute?

 
#6
People who like this:0Yes/0No
Interested
Rating: 16
Joined: Dec 4, 2017
Company:

Dear Alexey,

In the job's schedule, enable Every day and Every minute.

In the job's code, implement the planned checks in a cycle with the 1-second interval (for instance).

To avoid excessive processor workload, we recommend you to implement the 1-second pause via a call to an external component that uses the operating system's sleep method.

Indeed, this solution may seem awkward.

We can offer a better solution only after a thorough analysis of the requirements of your business case where you decided to inquire something with the intention of getting an immediate response to discovered changes.

For instance, if the inquiry is needed to provide online information to the user, you can do this in the context of a client's call to the server, instead of a scheduled job running constantly.

Best regards,
Vladimir Gurov

1C Company support team
 
#7
People who like this:0Yes/0No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

The code of the scheduled job checks from tax administration authorization of electronically issued invoices. Sometimes it take them a little to authorize, so instead of waiting the authorization, we run scheduled job every minute to get authorization of not authorized ones.
The code is basically query to information register for not authorized records and call to the web server of tax administration for the actual status.

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.