How to check CPU usage
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 05:00 PM
※Paris version
I'm running the following script on a job schedule.
var grInc = new GlideRecord('incident');
var schedule_count = 0;
grInc.query();
while (grInc.next()) {
var sched = new ScheduleOnce();
sched.script = '(' + scripte + ')();';
sched.label = "test_schedule";
sched.schedule1();
schedule_count += 1;
if (schedule_count >= 4) {
gs.sleep(3000);//Wait for the record to be reflected in the "sys_trigger" table
var grTri_count = rec_count();
gs.info("schedule count:" + grTri_count);
while (grTri_count == 4) {
gs.sleep(1000);//Check the "sys_trigger" table every second
grTri_count = rec_count();
}
schedule_count =grTri_count;
}
}
//Returns the number of running "test_schedule" schedules that exist in the "sys_trigger" table
function rec_count() {
var grTri = new GlideRecord('sys_trigger');
grTri.addQuery("name", "test_schedule");
grTri.addQuery("state", 1); //"1" is the running status
grTri.query();
return grTri.getRowCount();
}
//Wait 1 minute and send a message
function scripte(s) {
gs.sleep(60000);
gs.info("Test!!!");
}
Since I check the contents of the table every second in the following part of the script
I suspected that CPU usage was rising.
if (schedule_count >= 4) {
gs.sleep(3000);//Wait for the record to be reflected in the "sys_trigger" table
var grTri_count = rec_count();
gs.info("schedule count:" + grTri_count);
while (grTri_count == 4) {
gs.sleep(1000);//Check the "sys_trigger" table every second
grTri_count = rec_count();
}
schedule_count =grTri_count;
}
Does the meaning of "1.14" displayed in "System Overview" on the "Service Now Performance" screen mean CPU usage?
Since the value of MAX is "1.5", should "1.5" be considered 100%?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 12:47 PM
Hi, your response does not clear explain exactly what you are trying to achieve, just how you think you can achieve it.
thank you for your answer.
My true purpose is to run the scripts at the same time.
Simultaneous execution is performed to perform processing within a limited time.
sys_triggers are batch processed
Regardless of how they are created triggers are processed sequentially by the node worker they are assigned to, and they are assigned by a job that runs on a scheduled time frame not in real time. As a result I do not believe that true concurrency is possible (or if it would be actually necessary). In addition the underpinning database will also have limited ability to deliver concurrent CRUD actions.