-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
40% CPU spike due to query on QRTZ_LOCKS #1112
Comments
Can you post your scheduler factory configuration (stripping credentials etc)? |
Sure. ==== processorScheduler ====
==== notification scheduler ====
|
I'll need some time to investigate but I guess the biggest change has been that the query has been parametrized which also makes it look like being run two times more frequently if you have two separate schedulers (earlier there was different SQL string for each of them). |
That's correct, I do have multiple schedulers which all have similar configs as the above. |
Hi Marko, touching base for any update? |
I'm hoping to have time to work with this weekend. I haven't found anything obvious causing such performance regression but I think there's something between 2.x and 3.x that can be improved. |
Hi Marko, did you have the change to take a look at this buddy? |
Sorry, no big wins so far. I've discussed this with SQL Server DBA and he couldn't find any obvious reasons by testing, so it shouldn't be on DB side as it runs against same database page which should be super fast (small row count, two columns). If you have time to profile to pinpoint something obvious that I'm missing that would be super. |
Unfortunately, we can't profile. But, I have some other insight to share with you. Also, we noticed that your query is doing UPDLOCK, ROWLOCK on a SELECT statement, any reason why it needs to when it's not updating? I think if you change this to NOLOCK would be better. SELECT * Something in the v3.0.7 is making this query to run more often. |
I just talked again to my DBA and he did some more digging and found out in the old version this UPDATE query was used to get run, and since the upgrade, this query disappeared and the new SELECT above showed up. Notice also, the Sched_name was coming out as a text and not a parameter. (@lockname nvarchar(14)) And the old SELECT statement was this compared to the new one. Before Jan 27 Hope this helps. |
Thank you for the update and information.
This would mean that there would be no locks to protect from concurrent access, so I wouldn't go there 😉
This is the exact behavior that was intended after #818 was merged. You should see a lot more queries now with this exact SQL if you have multiple schedulers, they all use the same query plan thanks to using the query parameter instead of hard-coding the scheduler name into query which causes different plans. Re-reading your
This will cause it not to use the optimized SQL statement intended for SQL Server. See quartznet/src/Quartz/Impl/AdoJobStore/JobStoreSupport.cs Lines 492 to 521 in f612e3f
|
I've removed this property and also upgraded to the latest version, will let you know how it behaves. |
Hi Marko, just an update. The CPU is back to normal behaviour after the above updates. |
Great to hear, thanks for closing the loop. |
My app runs on .NET Framework 4.7.2 and was running an older Quartz version 3.0.7 for over a year with low CPU utilization, and a few weeks ago we upgraded Quartz to 3.2.3 and we noticed an immediate 40% CPU increase due to having this query being executed much more often with the newer version.
SELECT *
FROM QRTZ_LOCKS WITH(UPDLOCK,ROWLOCK)
WHERE SCHED_NAME = @schedulerName
AND LOCK_NAME = @lockname
Version used
Version: 3.2.3
To Reproduce
Don't have code to reproduce, but my app creates simple jobs and at a given time it has 10s of them executed on 4 different VM instances.
Expected behavior
The CPU should remain as it was with the older version.
btw, there are no errors reported by Quartz or our app, but this is the only side effect we see with version 3.2.3
The text was updated successfully, but these errors were encountered: