LibreTexts / Libretext

GNU General Public License v3.0
20 stars 8 forks source link

Rate limiting Batch.libretexts.org #152

Closed ymdahi closed 2 years ago

ymdahi commented 3 years ago

Problem

According to MindTouch, there is a 5000 calls per 5 minute threshold on their API service. batch.libretexts.org (159.65.100.70) seems to be exceeding this threshold, and is therefore being blocked automatically.

This may/may not be impacting other services, such as transclusions (https://github.com/LibreTexts/Libretext/issues/153).

Context

Batch hosts nodePrint, a microservice that generates PDFs of books/pages within LibreTexts.

We were notified recently (Sept 28) by MindTouch devs that this server had been blocked for exceeding the limit.

Possible Solution(s)

Next Steps

ymdahi commented 3 years ago

@Miniland1333 : any comments would be helpful.

Miniland1333 commented 3 years ago

I am unsure what changed that started causing this issue since I haven't touched that code in a while and they haven't complained about the load being that high.

To do a baseline test, I would recommend turning off the concurrency settings here: https://github.com/LibreTexts/Libretext/blob/530a67e576e46f349231df5f46a99a6832198662/nodePrint/nodePrint.js#L72

Set numThreads and concurrentTexts to 1. Hopefully, this should cause a proportional decrease in Mindtouch's traffic and you should check with them to confirm whether or not this occurs. If this doesn't fix the issue, then we truly have a deep mystery on our hands.

ymdahi commented 3 years ago

TODO:

Miniland1333 commented 2 years ago

image FYI it looks like batching for Chemistry has been broken for some time. I think you need to adjust schedule.js in order to get this working again with the lower rate.

https://chem.libretexts.org/Under_Construction/Development_Details/Admin_Tools/API_Dashboard

Miniland1333 commented 2 years ago

Duplicate of https://github.com/LibreTexts/Libretext/issues/169