- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2024 09:43 PM
Hi All,
I am looking into a Worker node which has 20 jobs affinity (run every 2-5 seconds) for flow, process automation, etc. When I look at the scheduled job history by node, I can see the execution adding up very fast, but cannot see these in Transaction background.
Anyone noticed this behavior? Is it because there may not be flows to be processed, hence job ran but transactions logs are not generated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2024 01:24 AM
Hello @varunkumar11863
Root Cause Analysis:
Job Execution without Flows to Process:
- If the scheduled jobs run frequently (every 2-5 seconds) and there are no flows, actions, or processes to execute, the job may complete quickly without performing any substantial operations. As a result, a transaction may not be logged in the background transaction history.
Transaction Logging Threshold:
- ServiceNow logs transactions for background processes when they meet certain thresholds (e.g., execution time or resource consumption). If the job's execution is lightweight (consuming minimal resources and completing quickly), it might not meet the criteria for logging.
Job Design and Logging Behavior:
- Some scheduled jobs might be designed to run and simply check for work. If no work is found (e.g., no flow triggers or process automation tasks), they may exit without performing actions that generate a loggable transaction.
Affinity and Job Distribution:
- Worker node affinity ensures that specific jobs run on a designated node, which could make the behavior more noticeable when monitoring scheduled jobs for that node.
Resolution Steps:
1. Verify Job Design:
- Review the logic of the scheduled job(s). Ensure that:
- The job has meaningful actions to perform.
- It does not run unnecessarily when there is no work to process.
- Consider adding conditional checks to prevent the job from executing when there are no flows to process.
2. Adjust Job Frequency:
- If the job is running too frequently and not finding work, increase the interval (e.g., from every 2-5 seconds to every minute). This reduces system resource usage and prevents unnecessary job execution.
3. Enable Debug Logging for the Job:
- Temporarily enable debug logging for the job to observe its execution behavior and see why transactions are not logged. This can help you understand what the job is doing during its run.
4. Monitor Flow Triggers:
- Check if flows and process automations are being triggered as expected. If they are not being triggered, investigate their conditions and dependencies.
5. Use Custom Logging:
- If necessary, add custom logging within the job script to record its execution details. Use gs.log() or a similar logging method to capture execution data for analysis.
6. Validate Node Affinity:
- Ensure that the worker node affinity configuration is correct and that it aligns with the intended execution of jobs.
Best Practices:
- Job Optimization: Optimize scheduled jobs to run only when necessary. Avoid frequent execution of lightweight or redundant tasks.
- Transaction Thresholds: Be aware of ServiceNow’s transaction logging thresholds and their impact on monitoring.
- Monitoring Tools: Use ServiceNow’s Performance Analytics or custom dashboards to track job execution and node activity.
- System Logs: Analyze system logs for any errors or warnings related to the scheduled jobs.
If the Issue Persists:
- Consider raising a ticket with ServiceNow support. Share details about the job design, execution frequency, and the behavior observed in the scheduled job history. They can provide further insights into transaction logging nuances or platform-specific issues.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank You
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2024 01:24 AM
Hello @varunkumar11863
Root Cause Analysis:
Job Execution without Flows to Process:
- If the scheduled jobs run frequently (every 2-5 seconds) and there are no flows, actions, or processes to execute, the job may complete quickly without performing any substantial operations. As a result, a transaction may not be logged in the background transaction history.
Transaction Logging Threshold:
- ServiceNow logs transactions for background processes when they meet certain thresholds (e.g., execution time or resource consumption). If the job's execution is lightweight (consuming minimal resources and completing quickly), it might not meet the criteria for logging.
Job Design and Logging Behavior:
- Some scheduled jobs might be designed to run and simply check for work. If no work is found (e.g., no flow triggers or process automation tasks), they may exit without performing actions that generate a loggable transaction.
Affinity and Job Distribution:
- Worker node affinity ensures that specific jobs run on a designated node, which could make the behavior more noticeable when monitoring scheduled jobs for that node.
Resolution Steps:
1. Verify Job Design:
- Review the logic of the scheduled job(s). Ensure that:
- The job has meaningful actions to perform.
- It does not run unnecessarily when there is no work to process.
- Consider adding conditional checks to prevent the job from executing when there are no flows to process.
2. Adjust Job Frequency:
- If the job is running too frequently and not finding work, increase the interval (e.g., from every 2-5 seconds to every minute). This reduces system resource usage and prevents unnecessary job execution.
3. Enable Debug Logging for the Job:
- Temporarily enable debug logging for the job to observe its execution behavior and see why transactions are not logged. This can help you understand what the job is doing during its run.
4. Monitor Flow Triggers:
- Check if flows and process automations are being triggered as expected. If they are not being triggered, investigate their conditions and dependencies.
5. Use Custom Logging:
- If necessary, add custom logging within the job script to record its execution details. Use gs.log() or a similar logging method to capture execution data for analysis.
6. Validate Node Affinity:
- Ensure that the worker node affinity configuration is correct and that it aligns with the intended execution of jobs.
Best Practices:
- Job Optimization: Optimize scheduled jobs to run only when necessary. Avoid frequent execution of lightweight or redundant tasks.
- Transaction Thresholds: Be aware of ServiceNow’s transaction logging thresholds and their impact on monitoring.
- Monitoring Tools: Use ServiceNow’s Performance Analytics or custom dashboards to track job execution and node activity.
- System Logs: Analyze system logs for any errors or warnings related to the scheduled jobs.
If the Issue Persists:
- Consider raising a ticket with ServiceNow support. Share details about the job design, execution frequency, and the behavior observed in the scheduled job history. They can provide further insights into transaction logging nuances or platform-specific issues.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank You
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2024 01:56 AM
Thanks Sanjay, it really clarifies my doubts. We will keep the setting as is, as it is working fine but would look to optimize in future if needed.