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

Rate limits from new IBM Bluemix Cloudant plans are not managed by the connector #56

Closed
l2fprod opened this issue Nov 16, 2016 · 13 comments

Comments

@l2fprod
Copy link

l2fprod commented Nov 16, 2016

Cloudant in Bluemix has plans with rate limits. It used to have a "Shared" plan with a limit of storage but the new plans have introduced read and write per second limits:
https://www.ibm.com/blogs/bluemix/2016/09/new-cloudant-lite-standard-plans-are-live-in-bluemix-public/

The Cloudant nodejs package has been updated to cope with the new limits and automatically retry. This is implemented with a Cloudant "retry" plugin:
https://github.com/cloudant/nodejs-cloudant#request-plugins

The loopback-connnector-cloudant should be updated to use the latest Cloudant nodejs package and support the configuration of the retry plugin.

Typically I'm getting http error 429 (the Cloudant error code when you reach the rate limit) and messages like:

Error: You've exceeded your current limit of 5 requests per second for query class. Please try later.
    at Request._callback (/Users/fred/dev/api/node_modules/nano/lib/nano.js:248:15)
    at Request.self.callback (/Users/fred/dev/api/node_modules/request/request.js:187:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/Users/fred/dev/api/node_modules/request/request.js:1044:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/Users/fred/dev/api/node_modules/request/request.js:965:12)
    at emitNone (events.js:91:20)
@l2fprod
Copy link
Author

l2fprod commented Nov 16, 2016

I tried a local fix l2fprod@f342236 enabling the retry plugin and obviously it solves the issue. Ideally this should be built-in into the connector with configuration from the datasource.

@xpqz
Copy link

xpqz commented Nov 24, 2016

It would be great if StrongLoop's Cloudant connector could wrap Cloudant's nodejs library. The Shared plan has been deprecated in favour of the new rate-capped Lite & Standard plans, and at the moment SL dies when used against the Lite plan. The Lite plan is intended to serve as a free-forever taster/development tier but applications using that need to be mindful of the caps. Cloudant's library has configurable backoff&retry handling through its retry plugin.

Stefan Kruger, IBM Cloudant.

@superkhau
Copy link
Contributor

superkhau commented Nov 24, 2016

@xpqz Thanks for the feedback, this is definitely something we should take into consideration (using the native nodejs library that supports rate-capped lite and standard plans).

@jannyHou We should add this to your connector's roadmap doc -- high priority too because this is obviously a barrier to entry for this project.

@kjdelisle
Copy link
Contributor

It seems like this issue is actually about not supporting plugin configuration in the connector; we're not passing through an options object that allows configuration of the nodejs-cloudant module.
https://github.com/strongloop/loopback-connector-cloudant/blob/master/lib/cloudant.js#L56
cc @superkhau @jannyHou

@l2fprod
Copy link
Author

l2fprod commented Nov 30, 2016

@kjdelisle you're right. I've a straightforward fix l2fprod@f342236 for my own app but would love to see plugin support built in the connector!

@kjdelisle
Copy link
Contributor

I've merged the passthrough into the master stream, and it should be a part of the connector's 3.0.0 release when that time comes.

@ibm-garage-nice
Copy link

Hi, do we have an idea when the 3.0.0 will be released?

@patsvc
Copy link

patsvc commented Apr 30, 2017

Any plans to port this to the LTS release? We would really like to have this fix because we keep hitting these limits.

@kjdelisle
Copy link
Contributor

@patsvc I'll add this to our backlog. It's not a breaking change, so I imagine it wouldn't be too much work.

@ssh24
Copy link
Contributor

ssh24 commented May 12, 2017

This should be released on v1.2.3

@jmereaux
Copy link

jmereaux commented May 22, 2017

Hi, still running into this issue after upgrading to 1.2.3 and adding the following to my datasource config:
'plugin': 'retry', 'retryAttempts': 5, 'retryTimeout': 1000

Seems like the issue is caused by a validatesUniquenessOf constraint added to my model.
Indeed, when performing a bulk create with this model, I get the following 422 error:
uniqueness.Error: You've exceeded your current limit of 5 requests per second for query class. Please try later."
Removing the uniqueness constraint solves the issue, but is not an acceptable solution.

Any advice?

@jannyHou
Copy link
Contributor

@jmereaux Is your model a User model or just a regular persistedModel? And which cloudant server are you using? A bluemix one or docker one or?

@jmereaux
Copy link

@jannyHou It is a regular PersistedModel. I'm using a Cloudant server on Bluemix (standard plan = 100 lookups/s, 50 writes/s, 5 queries/s)

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

10 participants