Giter Club home page Giter Club logo

Comments (10)

alextwoods avatar alextwoods commented on June 17, 2024

Sorry you're running into this! A minimal example would be great, but in the meantime, can you provide some details on how the producers/consumers are structured - eg, are these multiple threads in a single application?

from aws-sdk-ruby.

jpaulgs avatar jpaulgs commented on June 17, 2024

Yeah I'm sorry about not getting a minimal example up, we have found it difficult to produce one so far...

We currently have 8 active shards in the kinesis feed (4 were split) this is being processed by 4 ruby workers (individual processes running on different kubernetes pods) each consuming 2 shards. These workers are run on kubernetes with 2GB of RAM. This works fine until a burst of data comes through or the consumers slow down (even a little bit) at which point memory usage spikes and the pods get reaped.

from aws-sdk-ruby.

alextwoods avatar alextwoods commented on June 17, 2024

Yeah - creating examples for these is hard. I'm also working on trying to reproduce this...

How are you creating async clients on the workers? Are you sharing a single async client per worker?

Each async client should have a single H2::Connection, which should have only a single socket thread which is reading from the socket - and that thread is what runs any event handlers. So if your event handlers slow down, it should effectively slow down the reads from that socket.

How are you processing events? Can you provide any details?

from aws-sdk-ruby.

jpaulgs avatar jpaulgs commented on June 17, 2024

We spawn a thread for each shard (2 per worker). Within each of these threads we create an async client and subscribe that thread scoped AsyncClient to consume from 1 shard. We are processing each event as it arrives by passing a block to AsyncClient#subscribe_to_shard.

each thread blocks using async_resp.wait. When that wait step unblocks we allow the thread to die and create a new one.

We have played around with creating a single AsyncClient and passing it to each thread. That change did not stop our kubernetes pods being reaped with memory exceeding 2GB

from aws-sdk-ruby.

alextwoods avatar alextwoods commented on June 17, 2024

Thanks for description - that sounds pretty reasonable. I've been working on creating some similar small test case and was able to do a bit of memory profiling. I'm not 100% confident that this will fix your issue, but it does significantly reduce the number of large string allocations that are being done: #2834 and overall reduces the memory used (as long as you are not setting http_wire_log to true, which I assume you aren't for a production application....).

from aws-sdk-ruby.

mullermp avatar mullermp commented on June 17, 2024

@jpaulgs Are you seeing this issue again with the latest version of kinesis and aws-sdk-core 3.170.1?

from aws-sdk-ruby.

jpaulgs avatar jpaulgs commented on June 17, 2024

@mullermp we'll bump to using that version tomorrow but we are currently keeping up with records in prod so it'll take a little while to confirm.

from aws-sdk-ruby.

mullermp avatar mullermp commented on June 17, 2024

Thanks, just let us know. Re-open the ticket if it auto closes and it's still not resolved.

from aws-sdk-ruby.

github-actions avatar github-actions commented on June 17, 2024

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

from aws-sdk-ruby.

github-actions avatar github-actions commented on June 17, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

from aws-sdk-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.