-
Notifications
You must be signed in to change notification settings - Fork 0
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
Increased memory usage with many short-lived producers #39
Labels
Comments
agis
changed the title
Increased memory usage with many, short-lived producers
Increased memory usage with many short-lived producers
Aug 25, 2017
agis
added a commit
that referenced
this issue
Aug 25, 2017
agis
added a commit
that referenced
this issue
Aug 28, 2017
This revision contains the configurable events channel size which we need in order to address #39.
golang/go#16930 is now closed. We should verify that rafka built with Go 1.13 no longer suffers from this issue, and close this. Also relevant: golang/go#30333. |
After testing with go tip (65ef999), the situation is pretty much the same as before. So I'm leaving this open as a known issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have a pathological case where RSS can skyrocket: large number of short-lived producers.
Such a case is typical with some kind of forking client. resque for example, spawns a process per job and kills it after the job is done. Assuming a short-lived job that also produces 1 message to Rafka, we may end up with hundreds or even thousand of producers that are spawned only to produce a single message and die afterwards.
In the meanwhile, confluent-kafka-go producers are costly since each of them pre-allocates two 1M-buffers:
p.events
channel, accessible viap.Events()
p.produceChannel
channel, accessible viap.ProduceChannel()
The situation gets even worse cause of golang/go#16930.
Proposal
This could be fixed by re-architecting Rafka to have a N:M model (N=client producers, M=librdkafka producers), but that would require significant changes and would make Rafka usage more complex. We want to keep the 1:1 model if possible because it is simple.
However, we can remedy the issue in some ways:
produceChannel
to 0: This channel is completely unnecessary since we use the function-based producer (6ef4bf2)events
channelAllow clients to control their producer configuration: producer: Allow clients to control their configuration #40(defered)We should also state in the README that Rafka, like librdkafka itself is optimized for few long-lived producers instead of a bursty usage patterns (ie. many short-lived producers).
The text was updated successfully, but these errors were encountered: