{"id":496,"date":"2008-07-02T10:43:10","date_gmt":"2008-07-02T14:43:10","guid":{"rendered":"http:\/\/www.dr-chuck.com\/wordpress\/?p=496"},"modified":"2011-12-17T12:26:46","modified_gmt":"2011-12-17T16:26:46","slug":"in-paris-doing-some-code-sak-13886","status":"publish","type":"post","link":"https:\/\/www.dr-chuck.com\/csev-blog\/2008\/07\/in-paris-doing-some-code-sak-13886\/","title":{"rendered":"In Paris doing some Code (SAK-13886)"},"content":{"rendered":"<p>Well &#8211; there is a performance issue in the portal code in Sakai 2.5.  There are more queries to the SAKAI_SITE_PROPERTY in Sakai 2.5 than in 2.4.<br \/>\nIn looking at things there were several instances of &#8220;too many queries&#8221; &#8211; not just from 2.5 &#8211; but for a few features that were added to portal between 2.3 and 2.5.<br \/>\nSo I pored over the code for the last three days and figured out what kind of optimization which had already been done  &#8211; and figure out where bits were leaking through the prior optimization.<br \/>\nI talked to Aaron and Ian &#8211; and came up with two solutions &#8211; one using memcache for the properties and another using thread local.<br \/>\nI think that this will be important for Sakai 2.5 sites &#8211; My guess is that in the summer many are not noticing the additional query load on the main portal displays.  Without these patches things will likely slow down a bit and\/or consumer more resources.<br \/>\nI initially made a property to control which tables the properties get cached in memory &#8211; my guess is that particularly for 64-bit JVM&#8217;s this should be<br \/>\nDbFlatPropertiesCache=:all:<br \/>\nBut at a minimum this is needed:<br \/>\nDbFlatPropertiesCache=:SAKAI_SITE_PROPERTY:<br \/>\nAfter some testing and experience we should figure out which of these two should be the default.  I think that the methodology (suggested by Ian) is to look at query patterns and see if you are seeing too many hits on tables like:<br \/>\nSAKAI_SITE_PAGE_PROPERTY, SAKAI_SITE_TOOL_PROPERTY, SAKAI_SITE_GROUP_PROPERTY, &#8230;<br \/>\nThen simply add them to the list in preferences &#8211; and see if things get better.<br \/>\nThis is a nice, clean, short-lived memcache &#8211; and it is automated perfectly when properties are changed on the same server (i.e. when an instructor makes a change and presses refresh &#8211; the display will be perfect &#8211; instantly reflecting the changes).<br \/>\nThe Thread Local code is obvious and must be done.  It simply makes sure that the portal only gets the list of visitable sites once from the database.<br \/>\nBoth of these mods are really simple and clean and should be trivial to review.<br \/>\nI currently have some print statements that can be uncommented if folks want to watch the new caches in action.<br \/>\nOnce some testing happens &#8211; I will remove these before sending it to trunk.<br \/>\nNow this is done, I can start working on my talk for tomorrow about functionality mashup.<br \/>\nHere is my message to the dev list about it.<\/p>\n<p><!--more--><br \/>\ntest &#8211; you can use the code in these branches:<br \/>\nhttps:\/\/source.sakaiproject.org\/svn\/db\/branches\/SAK-13886<br \/>\nhttps:\/\/source.sakaiproject.org\/svn\/portal\/branches\/SAK-13886<br \/>\nThis is all described here:<br \/>\nhttp:\/\/bugs.sakaiproject.org\/jira\/browse\/SAK-13886<br \/>\nSince this is a cache thing and thread local thing &#8211; I am happy for<br \/>\nfolks to look it over before I move it to trunk.<br \/>\nOnce this is done I expect to put it into 2-5-x &#8211; I would guess that<br \/>\nfolks will want this performance fix to get the portal views less<br \/>\ncostly in terms of the number of queries needed to produce the main<br \/>\npage.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well &#8211; there is a performance issue in the portal code in Sakai 2.5. There are more queries to the SAKAI_SITE_PROPERTY in Sakai 2.5 than in 2.4. In looking at things there were several instances of &#8220;too many queries&#8221; &#8211; not just from 2.5 &#8211; but for a few features that were added to portal [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-496","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/496","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/comments?post=496"}],"version-history":[{"count":1,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/496\/revisions"}],"predecessor-version":[{"id":2607,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/496\/revisions\/2607"}],"wp:attachment":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/media?parent=496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/categories?post=496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/tags?post=496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}