Skip to content

[MySQL][Conn] Recyle write buffers if allocated#4120

Merged
sougou merged 1 commit intovitessio:masterfrom
danieltahara:recycle-write
Aug 12, 2018
Merged

[MySQL][Conn] Recyle write buffers if allocated#4120
sougou merged 1 commit intovitessio:masterfrom
danieltahara:recycle-write

Conversation

@danieltahara
Copy link
Copy Markdown

@danieltahara danieltahara commented Aug 4, 2018

After passing off the information needed from a read buffer, we recycle
it with recycleReadPacket(). We don't do the same with writes, which
means we hang out to allocated memory (in the case of
ephemeralWriteSingleBuffer and ephemeralWriteBigBuffer) until the next
write on the connection needs to allocate a new buffer (i.e. not using
the global buffer). In steady state, this means we will gradually
accumulate large buffers without ever letting them be GCed. This is
wasteful, so add an analagous recycleWritePacket().

Signed-off-by: Daniel Tahara tahara@dropbox.com

@danieltahara
Copy link
Copy Markdown
Author

Need to fix some things.

@danieltahara danieltahara force-pushed the recycle-write branch 2 times, most recently from cc25182 to cf4c53e Compare August 4, 2018 01:43
@danieltahara
Copy link
Copy Markdown
Author

image

Relevant here.

Profile of a process with about 35k client connections doing 1500 actual RPS. We bloat up to 1.5G of memory allocated by startEphemeralPacket on the write side, since we're not actually releasing the buffer.

@danieltahara danieltahara force-pushed the recycle-write branch 3 times, most recently from 766fa98 to 53357e6 Compare August 4, 2018 04:59
After passing off the information needed from a read buffer, we recycle
it with recycleReadPacket().  We don't do the same with writes, which
means we hang out to allocated memory (in the case of
ephemeralWriteSingleBuffer and ephemeralWriteBigBuffer) until the next
write on the connection needs to allocate a new buffer (i.e. not using
the global buffer). In steady state, this means we will gradually
accumulate large buffers without ever letting them be GCed. This is
wasteful, so add an analagous recycleWritePacket().

Signed-off-by: Daniel Tahara <tahara@dropbox.com>
Copy link
Copy Markdown
Contributor

@alainjobart alainjobart left a comment

Choose a reason for hiding this comment

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

Looks good!

@danieltahara
Copy link
Copy Markdown
Author

image 1
post-fix

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