calzoneman/aeiou

tts.cyzon.us rate limiting?

Closed this issue · 4 comments

By uncanny coincidence, I was thinking "it would be really cool to add text-to-speech to my CyTube instance, especially with the Moonbase Alpha voice engine", Googled around for it, came upon this, and realized you made both.

I don't really want to set up a Windows VM, but your API would fit my needs perfectly. The 1024 max character limit is fine.

What kind of rate limiting do you have set up, if any? Would you be ok with a peak load of like 15 TTS requests per minute from my server? It would probably be much less than that 99.9% of the time, but that's just my estimate of a peak.

I have very aggressive caching in place, so it's mostly unique messages that matter as far as rate goes (if you have 100 people requesting the same string then only 1 of them will render it and the other 99 will sit in a queue waiting for it to complete). If you mean 15 unique messages per minute, that should be fine.

I should probably add some per-IP throttling to the caching layer as well to prevent too many concurrent unique requests from hitting the speech generator.

I can keep a map of message content hashes to WAV URLs so there aren't any unnecessary requests.

And yes, I meant a 15 unique message per minute peak estimate. There's no problem with a queue delay.

You can certainly do that if you want, but I'm pretty sure cloudflare should be caching repeat requests anyways.

» curl -I http://tts.cyzon.us/tts?text=aeiou
HTTP/1.1 302 Found
...
CF-Cache-Status: HIT

True, though there'll be that tiny delay for the 302 redirect. Probably doesn't make a big difference either way.

If I don't do that, then I don't even need to add any server-side code, really. I'll probably just do it all client-side.