INFO [ScheduledTasks:1] 2019-11-04 11:01:19,755 QueryProcessor.java:139 - 49 prepared statements discarded in the last minute because cache limit reached (32899072 bytes)
prepared_statements_cache_size_mb:
Maximum size of the native protocol prepared statement cache
Valid values are either “auto” (omitting the value) or a value greater 0.
Note that specifying a too large value will result in long running GCs and possbily out-of-memory errors. Keep the value at a small fraction of the heap.
If you constantly see “prepared statements discarded in the last minute because cache limit reached” messages, the first step is to investigate the root cause of these messages and check whether prepared statements are used correctly - i.e. use bind markers for variable parts.
Do only change the default value, if you really have more prepared statements than fit in the cache. In most cases it is not neccessary to change this value. Constantly re-preparing statements is a performance penalty.
Default value (“auto”) is 1/256th of the heap or 10MB, whichever is greater
与此同时,还有一个挺诡异的问题,在凌晨的时候,我们的监控系统突然疯狂的电话告警,我们上去服务器查看的时候,发现cassandra所在的服务器CPU超高,MEM却没有什么变化,而且等了一会就恢复正常啦,所以一早上班,查看cassandra的日志发现有以下不正常的WARNING:
cassandra自己在做GC吗????导致这个问题的根本原因就是cassandra在GC,而且是发生了很长时间的GC,导致那个时刻CPU超高,而且整个连接数据库的请求都无法响应而失败了。
可以参考这两个JIRA写的case:
https://issues.apache.org/jira/browse/CASSANDRA-9183
https://issues.apache.org/jira/browse/CASSANDRA-9218
微信公众号,搜索:zhangdaopin,也可方便快捷的看到本人的博客哦,谢谢~