{"id":37114,"date":"2017-08-03T02:17:03","date_gmt":"2017-08-03T09:17:03","guid":{"rendered":"\/blog\/?p=13737"},"modified":"2023-06-05T16:06:54","modified_gmt":"2023-06-05T14:06:54","slug":"important-cache-tuning-exo-platform","status":"publish","type":"post","link":"https:\/\/www-upgrade.exoplatform.com\/blog\/important-cache-tuning-exo-platform\/","title":{"rendered":"How important is cache tuning in eXo Platform?"},"content":{"rendered":"<p>Exo Platform uses caches for almost all applications. Therefore, how an application performs can be significantly affected by the cache settings.<\/p>\n<p><!--more--><\/p>\n<p>This article will help you understand the importance of <strong>cache tuning in eXo Platform<\/strong> and how to find the best settings for your installation.<\/p>\n<h2>Why is cache tuning important? Do the default settings fit all eXo Platform installations?<\/h2>\n<p>eXo Platform can scale from laptop demos to a multi-server with hundreds of thousands of users. But the default settings are preconfigured for demo and test purposes only. These default values ensure that we avoid JVM out of memory errors \u2013 when memory consumption exceeds the maximum allowed memory size.<\/p>\n<p>This is why the preconfigured cache parameters are set to be small. However, increasing the JVM max heap size will not necessarily help to improve performance if you do not tune cache parameters correctly switch the Platform usage.<\/p>\n<p>To give a common example, setting JVM max heap size to 16GB without cache tuning could lead to using just 5GB, when the application needs more. You need to remember that the cache maximum size (maximum objects per cache) is limited and doesn\u2019t directly correlate with the JVM max heap size.<\/p>\n<p>So the cache parameters couldn\u2019t be common to all installations and should be determined switch your installation use cases.<\/p>\n<h2>What happens if I don\u2019t change the default values?<\/h2>\n<p>If the cache size parameter is limited to 30 entries and you have 40 entries to add in the cache, you will eventually observe a decrease in performance. This can happen for many reasons, but the most common is that the cache has reached its maximum allowed elements. At this point, the information required by the application must be retrieved from stores (e.g. RDBMS, LDAP) instead of the application cache.<\/p>\n<p>This is more noticeable in cluster mode because of write and synchronisation messages between cluster members\/nodes.<\/p>\n<h2>What should I take into account when increasing cache capacity?<\/h2>\n<p>If you increase the cache capacity, you should also increase the JVM max heap size.<\/p>\n<h2>What cache parameters can I tune?<\/h2>\n<p>Before you start to tune caches, you should estimate and calculate the following variables:<\/p>\n<ul>\n<li style=\"font-weight: 400;\">JVM Xmx and Xms.<\/li>\n<li style=\"font-weight: 400;\">Each cache entry consumption estimation in memory. You can estimate the size of cache objects by generating a heap dump.<\/li>\n<li style=\"font-weight: 400;\">The estimated maximum concurrent users that the system has to support. Some caches require as a minimum size the number of concurrent users, such as user\u2019s activities cache and user\u2019s people network cache.<\/li>\n<li style=\"font-weight: 400;\">The lifecycle of the cached objects for each cache. Is the cache content frequently changed?<\/li>\n<\/ul>\n<p>These answers will help you to improve the behaviour, performance, capacity and horizontal scalability of your system.<\/p>\n<p>In eXo Platform, there are three types of cache:<\/p>\n<ul>\n<li style=\"font-weight: 400;\">Java Content Repository (JCR; data, indexes, locks): no need to tune these \u2013 parameters are optimal for almost all conditions.<\/li>\n<li style=\"font-weight: 400;\">Identity management caches (IDM): no need to tune these \u2013 rarely used.<\/li>\n<li style=\"font-weight: 400;\">eXo Services: you can tune these following the instructions in <a href=\"https:\/\/docs.exoplatform.org\/PLF44\/PLFAdminGuide.Configuration.CacheConfiguration.html\" class=\"broken_link\" target=\"_blank\" rel=\"noopener\">this document<\/a>.<\/li>\n<\/ul>\n<h2>How do I monitor cache statistics?<\/h2>\n<p>You can monitor cache size, miscount and hitcount using JMX. (An example of a cache MBean exo:portal=portal,service=cache,name=ActivitiesCache.)<\/p>\n<p>For more information on eXo Platform\u2019s management and monitoring gadgets, read <a href=\"https:\/\/docs.exoplatform.org\/PLF44\/PLFUserGuide.AdministeringeXoPlatform.ManagingApplications.ManagementMonitoringGadgets.html\" class=\"broken_link\" target=\"_blank\" rel=\"noopener\">this document<\/a>.<\/p>\n<h2>Conclusion<\/h2>\n<p>I wanted to share with you how tuning caches can make the difference between a performing system and an installation that doesn\u2019t work well. However, you will need to test this before going live.<\/p>\n<p>As you probably know, no system should go live without a good monitoring system and performance benchmarking phase to ensure proper stability and scaling. Of course, there are many factors to consider in the performance benchmarking phase \u2013 such as network bandwidth, blocking operations and systems and RDBMS performance. Application caches is just another to add to the list.<br \/>\nIf you need any help with this process, please don\u2019t hesitate to ask our <a href=\"https:\/\/www.exoplatform.com\/?utm_source=BlogEn&amp;utm_medium=Blog&amp;utm_campaign=Content&amp;utm_content=link\" target=\"_blank\" rel=\"noopener\">experts<\/a>.<\/p>\n<div>\n<div class=\"adv-events\" style=\"background: #476fad; padding: 30px 20px; color: white;\">\n<div class=\"media\">\n<div class=\"pull-right\"><a href=\"https:\/\/community.exoplatform.com\/portal\/dw\/\" target=\"_blank\" rel=\"noopener\"><br \/>\n<img decoding=\"async\" class=\"size-full wp-image-6587 alignright\" style=\"border: none;\" src=\"https:\/\/www-upgrade.exoplatform.com\/blog\/wp-content\/uploads\/2016\/02\/tribe.png\" alt=\"Join The eXo Tribe\" height=\"120px\"><br \/>\n<\/a><\/div>\n<div class=\"media-body\">\n<h4 class=\"media-heading\"><a href=\"https:\/\/community.exoplatform.com\/portal\/dw\/\" target=\"_blank\" rel=\"noopener\">Join The eXo Tribe<\/a><\/h4>\n<p><a href=\"https:\/\/community.exoplatform.com\/portal\/dw\/\" target=\"_blank\" rel=\"noopener\"><br \/>\nRegister for our Community to Get updates, tutorials, support, and access to the Platform and add-on downloads. <strong>Sign in Now!<\/strong><br \/>\n<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"Exo Platform uses caches for almost all applications. Therefore, how an application performs can be significantly affected by the cache settings.","protected":false},"author":71,"featured_media":13738,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":[],"categories":[409],"tags":[606,827],"lang":"en","translations":{"en":37114},"pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/www-upgrade.exoplatform.com\/blog\/wp-json\/wp\/v2\/posts\/37114"}],"collection":[{"href":"https:\/\/www-upgrade.exoplatform.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www-upgrade.exoplatform.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www-upgrade.exoplatform.com\/blog\/wp-json\/wp\/v2\/users\/71"}],"replies":[{"embeddable":true,"href":"https:\/\/www-upgrade.exoplatform.com\/blog\/wp-json\/wp\/v2\/comments?post=37114"}],"version-history":[{"count":0,"href":"https:\/\/www-upgrade.exoplatform.com\/blog\/wp-json\/wp\/v2\/posts\/37114\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www-upgrade.exoplatform.com\/blog\/wp-json\/wp\/v2\/media\/13738"}],"wp:attachment":[{"href":"https:\/\/www-upgrade.exoplatform.com\/blog\/wp-json\/wp\/v2\/media?parent=37114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www-upgrade.exoplatform.com\/blog\/wp-json\/wp\/v2\/categories?post=37114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www-upgrade.exoplatform.com\/blog\/wp-json\/wp\/v2\/tags?post=37114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}