-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Additional improvements to memory pooling and management. #2960
Conversation
server/filestore.go
Outdated
@@ -2047,6 +2069,7 @@ func (fs *fileStore) removeMsg(seq uint64, secure, needFSLock bool) (bool, error | |||
// we don't lose track of the first sequence. | |||
if firstSeqNeedsUpdate { | |||
fs.selectNextFirst() | |||
// FIXME(dlc)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reminder! I don't think that statement is correct, will look more closely now.
} | ||
} | ||
} | ||
// Copy here to not reference underlying buffer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this... subjString() is invoked with a string that is already a string (either from caller stack or made a string out of the underlying buffer), so I don't see how "key" is referencing the underlying buffer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was seeing higher memory usage until this change, if it was referencing the underlying buffer I believe runtime could reference it vs copy on the cast.
…fix for firstMatching that did unnecessary work when matching all. During contention to the head write blk, the system could perform worse memory wise compared to simple go runtime. Also had some references for the subject of messages bloating memory. Signed-off-by: Derek Collison <derek@nats.io>
This may prevent memory copies when not necessary. Also fixed a bug there that would check twice if there was only 1 subject and that subject did not match (say configured subject is foo.* and key is foo.bar). Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
…. This would possibly cause the load code to thrash since it would not be big enough for a full block and we would need to recycle again and make a new one. Signed-off-by: Derek Collison <derek@nats.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
During contention to the head write block, the system could perform worse memory wise compared to simple go runtime and GC. Also had some references for the subject of messages being read back in to the underlying block which was bloating memory.
Additionally a fix for firstMatching() that did unnecessary work when matching all. This would cause excessive CPU and excessive load on the garbage collector.
Signed-off-by: Derek Collison derek@nats.io
/cc @nats-io/core