agco / harvesterjs

Create JSONAPI-compliant APIs over a Node.js + MongoDB stack in an easy, boilerplate-free manner
http://agco.github.io/harvesterjs/
MIT License
68 stars 13 forks source link

1368 - Harvester opens too many connections #164

Closed niahmiah closed 8 years ago

niahmiah commented 8 years ago

I reverted to commit 6a39d52b43f67f6871a1b95832edd7d27335ffee and reattempted SSE connection fix.

Each instantiation of SSE needs to keep 1 connection open for the tailable cursor. So, on line 71 of sse.js, I set the poolSize manually instead of using the default of 5. However, for some reason, setting the connectionPool size to 1 made the tests fail. Setting it to 2 seemed to be the sweet spot for the tests.

This should result in ~60% reduction in mongo connections for applications using harvester w/ sse.

  

niahmiah commented 8 years ago

I'd like to have a discussion regarding what I am seeing when testing this.