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

Make created_at/enqueued_at storing integer milliseconds #6564

Merged
merged 1 commit into from
Dec 31, 2024

Conversation

fatkodima
Copy link
Member

Discussion #6562.

With this PR, sidekiq will now store created_at/enqueued_at timestamps as integer milliseconds since the epoch.
It will also currently accept timestamps in the old format (fractional seconds since the epoch) for existing jobs.

@mperham
Copy link
Collaborator

mperham commented Dec 24, 2024

How do the benchmarks look?

@fatkodima
Copy link
Member Author

Time benefit is the same as if using integers, but memory benefit is 2x worse than if using integers (for integers we will save 180mb in redis, but for milliseconds now 90mb).

@mperham mperham merged commit b7e116c into sidekiq:main Dec 31, 2024
7 of 10 checks passed
@mperham
Copy link
Collaborator

mperham commented Dec 31, 2024

I switched the implementation to use:

::Process.clock_gettime(::Process::CLOCK_REALTIME, :millisecond)

as it benchmarked as over 2x faster than (Time.now.to_f * 1000).floor.

@fatkodima fatkodima deleted the integer-timestamps branch January 1, 2025 00:09
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.

2 participants