On 2017-02-17 18:12 (-0800), Abhishek Verma <ve...@uber.com> wrote: > > > Is there a way to throttle read and write queries in Cassandra currently? > If not, what would be the right place in the code to implement a pluggable > interface for doing it. I have briefly considered using triggers, but that > is invoked only in the write path. The initial goal is to have a custom > pluggable class which would be a no-op. >
The only real tunable you have now are the yaml properties for limiting concurrent reads and concurrent writes - you can tune those per-server to limit impact (set them low enough that queries back up rather than crash the cluster). Other databases tend to express this per-user ( MySQL, for example https://dev.mysql.com/doc/refman/5.7/en/user-resources.html, provides options like MAX_QUERIES_PER_HOUR and MAX_UPDATES_PER_HOUR ) - I'm not aware of any proposed tickets like that (other than some per-partition, which is a different protection), but there are some tangential tickets floating around that involve "limiting" user accounts. For example, https://issues.apache.org/jira/browse/CASSANDRA-8303 was designed to protect clusters from less experienced users (notably some of the "features" that tend to be misused) - the linked design doc describes it as being modeled after posix capabilities, so it's not really the same proposal, however, you could look at the code there and come up with something similar. Given how involved a rate-limiting patch would be, you'll want to take the same approach that Sam took there - write a design doc first (like https://docs.google.com/document/d/1SEdBEF5c4eN2VT2TyQ1j-iE0iJNM6aKFlYdD7bieHhQ/edit ) , before you write any code, and ask for feedback.