Cassandra - prepared statements discarded in the last minute because cache limit reached

        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,也可方便快捷的看到本人的博客哦,謝謝~

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章