Desktop version

Main > Forum > 1C:Enterprise Platform > Bugs and functionality requests to 1C:Enterprise platform > Scheduled jobs use all CPUs

Forum

Search UsersRules
Scheduled jobs use all CPUs
#1
Interested
Points:: 15
Joined:: Oct 27, 2011

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?

Profile
#2
Interested
Points:: 0
Joined:: Dec 4, 2017

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

Profile
#3
Interested
Points:: 15
Joined:: Oct 27, 2011

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.

Profile
#4
Interested
Points:: 0
Joined:: Dec 4, 2017

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

Profile
#5
Interested
Points:: 15
Joined:: Oct 27, 2011

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?

Profile
#6
Interested
Points:: 0
Joined:: Dec 4, 2017

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

Profile
#7
Interested
Points:: 15
Joined:: Oct 27, 2011

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.

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.