Skip to content
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

optimize pool performance #28

Merged
merged 3 commits into from
Dec 22, 2022
Merged

optimize pool performance #28

merged 3 commits into from
Dec 22, 2022

Conversation

DNK90
Copy link
Contributor

@DNK90 DNK90 commented Dec 21, 2022

optimize pool performance by stop storing pending and done jobs to db
benchmark results with BenchmarkPool-16 and pool size = 8196:
| data size | solve time (ms) |
| 10000 | 194 |
| 100000 | 1565 |
| 1000000 | 11531 |
| 10000000 | 102254 |

@DNK90 DNK90 requested review from minh-bq and linh-1 December 21, 2022 14:34
@@ -109,8 +113,14 @@ func (p *Pool) startWorker(w Worker) {
if job == nil {
continue
}
if p.isClosed.Load().(bool) {
// update job to db
if err := job.Update(stores.STATUS_PENDING); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The update queries for job with id in DB and update the status, so if we don't have that job in DB, this doesn't do anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is basically rely on the implementation of the job (implementation of the JobHandler). In this case, update acting as inserting

@DNK90 DNK90 merged commit e2b767c into master Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants