Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is wrong with embedding solr

Tags:

java

solr

I use Solr in a web app. Since deployment would be simpler, I would like to embed Solr. However, http://wiki.apache.org/solr/EmbeddedSolr says "Embedding Solr is less flexible, harder to support, not as well tested, and should be reserved for special circumstances"?

I would like to understand the trade-off in more detail. I would like to know why it is less flexible? What are the situations where it is recommended to use embedded mode?

like image 586
krishnakumarp Avatar asked Nov 06 '13 07:11

krishnakumarp


2 Answers

As far as I know these caveats hold true

No Way To Expose The Embedded Server

If you, one day, would like to expose the solr part of your application to the rest of the world, you will not be able to. That has been elaborated in the SO question Access embedded Solr server from external application

No Admin Interface

The embedded server does not offer an admin interface. This makes sense, as it is not accessible from the outside, see previous caveat. Moreover while the embedded server is running, you cannot access the cores in its' solr home with another full fledged Solr installation that does offer an admin interface. That has been elaborated in the SO question How to access the admin interface of an EmbeddedSolrServer instance?

No Sharding Support

As you can read in the SO question How to connect embedded solr with each other by sharding there is a still open issue that sharding is not supported by the embedded server.

like image 177
cheffe Avatar answered Sep 20 '22 12:09

cheffe


The embedded server is recommended when you need a simple solution that is not distributed. For example when writing small unit and integration tests you might want to have a special Solr instance with special configurations such like using RamDirectories and not writing changes back.

This is also true for development databases. I always use in-memory databases not writing back to file loading a preset scenario (I also use for acceptance and integration tests). This way you have a speed advantage on restarting application and doing regression tests. It is a difference if your server is up in one second or in 10 seconds and that is what you can Achive. If your tests run slowly you are slowed down when it comes to test driven development.

Also another thing is if you need a dedicated Solr server instance or require cloud functionality you can easily switch from using an embedded server to a stand alone server. This is just some lines of code and you are done.

So if you do not know if you need a dedicated server just start with the embedded version and enjoy simplified configuration and setup and a minor performance increase. Once you need a stand alone server, just change some lines of code and the rest stays the same.

like image 23
Martin Kersten Avatar answered Sep 19 '22 12:09

Martin Kersten