Skip to content

Large streams are blocking and CPU Intensive #149

Closed

Description

@joshua-mcginnis

We have a proc call which returns over 100K records. The problem we're having is that streaming these pegs the CPU and blocks other processes.

What we've got is pretty basic - we're pushing the rows onto a transform stream:

var stream = new stream.Transform();
request.on('row', function(row) {
  stream.push(row);
});

We've tried to use process.nextTick as I've outline in this stackoverflow post covering this same issue, but it doesn't resolve the problem.

I'm wondering if anyone has any ideas on how to mitigate this?

Activity

  1. joshua-mcginnis commented on May 12, 2014

    @joshua-mcginnis
    Author

    It totally has to do with tedious not actually creating a stream and simply emitting rows.

    @patriksimek any thoughts on this? Why not use proper streams instead of or with an EventEmitter? Emitting rows to a proper stream would allow back-pressure and we'd be able to solve our high CPU issues.

  2. patriksimek commented on May 13, 2014

    @patriksimek
    Collaborator

    I'm thinking about rewriting Tedious to streams for a long time, but unfortunately I don't have enough time to do that atm. If you or anyone is interested in doing that, PR is welcome. I'll try to get to it soon.

  3. rossipedia commented on Sep 29, 2014

    @rossipedia
    Contributor

    Currently no. Feel free to jump on board!

  4. bretcope commented on Sep 29, 2014

    @bretcope
    Member

    Let's just have one issue for this feature, instead of two. #186 has more details, so let's use that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions