Skip to content
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

Open
3 of 4 tasks
agis opened this issue Aug 25, 2017 · 2 comments
Open
3 of 4 tasks

Increased memory usage with many short-lived producers #39

agis opened this issue Aug 25, 2017 · 2 comments
Assignees

Comments

@agis
Copy link
Contributor

agis commented Aug 25, 2017

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:

  • the p.events channel, accessible via p.Events()
  • the p.produceChannel channel, accessible via p.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:

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).

@agis agis added this to the 1.0 milestone Aug 25, 2017
@agis 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.
agis added a commit that referenced this issue Aug 29, 2017
This is a follow-up to 2f5a1f0 and a part of #39.
@agis agis closed this as completed Sep 5, 2017
@agis agis reopened this Jun 6, 2018
@agis
Copy link
Contributor Author

agis commented May 23, 2019

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.

@agis agis self-assigned this May 23, 2019
@agis
Copy link
Contributor Author

agis commented May 23, 2019

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.

@agis agis closed this as completed May 23, 2019
@agis agis reopened this May 23, 2019
@agis agis removed this from the 1.0 milestone May 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant