{"id":59,"date":"2013-02-01T13:25:53","date_gmt":"2013-02-01T12:25:53","guid":{"rendered":"http:\/\/www.francelabs.com\/blog\/?p=59"},"modified":"2013-03-15T12:16:42","modified_gmt":"2013-03-15T11:16:42","slug":"slow-constellio-admin-interface","status":"publish","type":"post","link":"https:\/\/www.francelabs.com\/blog\/slow-constellio-admin-interface\/","title":{"rendered":"Slow Constellio admin interface"},"content":{"rendered":"<p>During a customer installation of Constellio 1.3, we have noticed an utterly slow loading of the admin interface, which is rather unusual (it is not that slow on other installs with the same amount of indexed content).<br \/>\nAfter an analysis, we have identified that the Constellio admin UI triggers every 5 seconds a query to its Solr, in order to know the number of indexed files, so as to update this figure in its admin UI. And in our particular installation, this query was taking an awful time to be processed (although the user queries were very fast). We could have changed the query frequency, but even the query by itself was slow. So we decided to change the query in order to have a much better query time.<!--more--><\/p>\n<p>Change the implementation of the method countIndexedRecords of the class com.doculibre.constellio.services.StatusServicesImpl with the following code, and voil\u00e0, your life will be brighter :<\/p>\n<p><code> @Override<br \/>\npublic int countIndexedRecords(RecordCollection collection) {<br \/>\nint count;<br \/>\nSolrServices solrServices = ConstellioSpringUtils.getSolrServices();<br \/>\nSolrServer solrServer = solrServices.getSolrServer(collection);<br \/>\nif (solrServer != null) {<br \/>\nSolrQuery q = new SolrQuery(\"*:*\");<br \/>\nq.setRows(0);<br \/>\nq.setParam(\"collectionName\", collection.getName());<br \/>\nq.setParam(ConstellioSolrQueryParams.USER_ID, \"\" + 1);<br \/>\ntry {<br \/>\nQueryResponse queryResponse = solrServer.query(q);<br \/>\ncount = (int) queryResponse.getResults().getNumFound();<br \/>\n} catch (SolrServerException e) {<br \/>\nthrow new RuntimeException(e);<br \/>\n}<br \/>\n} else {<br \/>\ncount = 0;<br \/>\n}<br \/>\nreturn count;<br \/>\n} <\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>During a customer installation of Constellio 1.3, we have noticed an utterly slow loading of the admin interface, which is rather unusual (it is not that slow on other installs with the same amount of indexed content). After an analysis, &hellip; <a href=\"https:\/\/www.francelabs.com\/blog\/slow-constellio-admin-interface\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,1],"tags":[17,4,16],"class_list":["post-59","post","type-post","status-publish","format-standard","hentry","category-constellio","category-search","tag-admin","tag-constellio-2","tag-slow"],"_links":{"self":[{"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/posts\/59","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/comments?post=59"}],"version-history":[{"count":8,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/posts\/59\/revisions"}],"predecessor-version":[{"id":67,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/posts\/59\/revisions\/67"}],"wp:attachment":[{"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/media?parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/categories?post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.francelabs.com\/blog\/wp-json\/wp\/v2\/tags?post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}