To continue this series of blogs about Elastic Search, I would like to focus on performance. A lot of customers ask the big question: for search, what is the best solution? Liferay as is? Solr? Elastic Search? Anything else? Many people would say that there is no correct answer for this, that it depends on a lot of factors, how important are searches, managability of the environment, integration with additional platforms, and many more…
Liferay default search vs Solr plugin vs Elastic Search plugin
I am going to try to help answering this question with a brief test between Liferay Lucene, Solr and Elastic Search. What I am going to do is compare the relative performance between the following environments:
- Liferay 6.1 EE Tomcat bundle, with MySQL database and Lucene indices in file system.
- Environment 1 with Solr plugin, and Solr server 1.4.
- Environment 1, with Elastic Search plugin, and Elastic Search server 0.19.4.
As my objective was just to know the relative difference between using Solr plugin, Elastic Search plugin or no plugin at all, and not to measure the performance of an optimized multi-server clustered configuration in this test, what I did was to prepare in the same computer
- Liferay-Tomcat bundle
- MySQL database
- Elastic Search server
- Solr server
all running at the same time with the default configuration. And yes, it is incredible but my laptop did not explode in the attempt!! Thanks boss, I have a great laptop!!!
Why everything running at the same time? I repeat, the performance is not important in this test, it is just the difference between using one choice or another, so I wanted to have the most similar environment to avoid distorting the results.
I used jMeter for testing and jConsole and visualVM to see what was going on the machine. The Apache jMeter was configured with 200 concurrent threads and a loop of 10 seconds (so 2000 samples), and the test was performed three times in every environment.
The tests where done with the same search with Liferay’s web search portlet (a simple one, not using special characters or anything else) every time, knowing that the word I was looking for was present in about the 40% of the contents of my database (web content, wikies, forums, users, documents, …).
While searching, the Tomcat, Solr and Elastic Search servers behaved nicely, with no problems at all in any of them.
Tomcat behaviour while searching in Liferay with no plugin:
Elastic Search server behaviour while searching in Liferay with Elastic Search plugin:
Results:
Search | Lucene/Solr | Lucene/ES | Solr/ES |
---|---|---|---|
Performance tests results comparative | |||
Best time | 1.29 | 1.43 | 1.10 |
Worst time | 1.19 | 1.29 | 1.09 |
Average time | 1.25 | 1.37 | 1.10 |
Avg time deviation | 1.44 | 1.59 | 1.10 |
Let’s understand what this table represents. If, for example, the best search time with no search plugin (just the Liferay default search) was 645 ms, and after deploying the Solr plugin (and of course reindexing the portal) the best search time has been 500 ms, the “Lucene/Solr” relation is 645 ms / 500 ms = 1.29, so using Solr plugin instead using Liferay’s default search it’s faster.
So looking at the results, and with the standard configurations in the same environment, the use of search plugins instead of the Liferay default search is better, and, ladies and gentlemen, we have a winner!! The Elastic Search plugin performs better in this case!
If you have any question, need help or want to give me your impressions, just let me know or contact Xtivia!!!! We are glad to help you!