-
Notifications
You must be signed in to change notification settings - Fork 341
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
How to tune NanoLog to better handle burst? #46
Comments
Hm, that is very strange. The statistics you gave should be well within NanoLog's performance envelope. Even if the messages were 1KB (rounded up), that should only result in 160KB of space, and the default configuration allocates ~1MB of staging buffer space per thread. There should be enough space to handle your workload. Additionally, NanoLog is a guaranteed logger, so all statements should have executed before continuing to the next line of code in your application. Is there some source code you could point me to that would reproduce this bug? In the mean time, could you perform some sanity checks for me:
|
I will have to dig further to understand why. For your sanity check questions,
Another strange thing is that it does not help if I add NanoLog::sync right after the NANO_LOG statement, and still about half of the messages are dropped in that case. I have to add NanoLog::sync right before the Log statement and then no more missing messages. I will have to play with it a little bit more and see what I can get. Will let you know if any finding. |
There is no bug in NanoLog. In the same thread where I logged the received message, I had another log that has a typo in the format string, where "%s" is used for an integer value by mistake. So if several messages are encoded in one call of encodeLogMsgs in the compression thread, all messages after the log message with wrong format are lost in the decompressor. |
I'm testing NanoLog in a program, and noticed that roughly half of the messages were dropped in the log.
Here is the setting of my testing program. The program is multithreaded, and one of the worker threads is reading some msg (roughly 0.5k bytes per msg) from socket and log it and then process it. During the test, I read roughly ~160 msgs within 2 min from the socket, and logged all of them. However, only ~80 of them showed up in the log file. One of the cases I noticed is that the program handled ~10 msgs within 2 mini second, and only the first and last of the 10 msgs were successfully logged.
If I tweak the program to sleep for 1 second or call NanoLog::sync before logging the msg, all ~160 messages will be logged successfully.
So I looked at the runtime/Config.h file, and tried the following two settings, but strangely enough I saw no improvement and still roughly half of the messages were dropped.
STAGING_BUFFER_SIZE = 1<<25
RELEASE_THRESHOLD = 1<<19
STAGING_BUFFER_SIZE = 1<<25
RELEASE_THRESHOLD = 1<<20
Any suggestions on how I should tune the parameters to better handle burstiness? Thank you.
The text was updated successfully, but these errors were encountered: