-
Notifications
You must be signed in to change notification settings - Fork 148
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
Add note about at_exit into README #207
Conversation
One thing that comes to my mind is if this does not break something - by deleting there could be information loss. In that case proper "squashing" needs to be implemented and that should be probably done automatically by the library at random, or actually during exit in a similar manner. |
1 similar comment
Hi @lzap, So, if your entire app is exiting / rebooting, it's a good idea to delete all the files in the Could you confirm if you think i'm wrong that worker processes may exit and execute this block without the rest of the app exiting? Proper squashing as you say would help with this, and it would be great to implement that. We're not looking at that at the moment, but we do accept contributions :-D |
Another option is what I started doing in this PR We could have an option (be it a separate store, or a parameter in the store if you can find a way to make that work) for "one file per process", instead of "one file per metric per process". This would add locking if a process has multiple threads incrementing counters at the same time, but that's unlikely to be an issue in a multi-process environment, I believe. It may also have other performance implications, so it should probably not be the default.[ |
Apologies for the delay.
Hmmm, I haven't actually realized this. Counters must be monotonic indeed.
Yeah, this is right. Many app servers do this. I guess some proper squashing needs to be added and I can imagine this won't be an easy task. Sorry for the noise. |
Squashing would indeed help a lot. In any case, I think we'd probably get a lot more bang for the buck if we changed to "one file per process" instead of "one per process per metric". That alone will drastically reduce the number of files. I took a stab at it here, and failed to make the same code be configurable for both settings without major refactoring. If you think you'd have time to look into it, i'd love to brainstorm/help a bit if you want, and figure out how we can do that, that's probably the most valuable improvement we can make to the gem. Thanks! |
I think we found a way to mitigate problem with many metric temporary files accumulating over time. It's definitely better with this solution. Although this block could be probably part of the library, I'd rather have this explicit in our initializer.