You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Joachim Martin <jm...@path-works.com> on 2006/09/07 15:32:14 UTC
SolrCore as Singleton?
Is there a good reason for implementing SolrCore as a Singleton?
We are experimenting with running Solr as a Spring service embedded in
our app. Since it is a Singleton
we cannot have more than one index (not currently a problem, but could be).
I note the comment:
// Singleton for now...
If there is no specific reason for making it a Singleton, I'd vote for
removing this so that the
SolrCore(dataDir, schema) constructor could be used to instantiate
multiple cores.
Seems to me that since the primary usage scenario of solr is access via
REST (i.e. no Solr jar/API),
the Singleton pattern is not necessary here.
--Joachim
Re: SolrCore as Singleton?
Posted by Eivind Hasle Amundsen <ei...@ifi.uio.no>.
Tim Archambault wrote:
> In regard to the comment about lack of an interface, I view this as a
> benefit of the tool.
>
> Whether I'm developing with Python, PHP, Coldfusion, .NET, Java, etc.
> I can create my own customizable interface. As a coldfusion programmer
> with moderate programming capabilities, this tool is perfect for my
> needs.
That's good to hear. I never meant that a GUI should replace anything at
all. Did it come out that way?
As the product evolves, it is only natural to add capabilities and
features. Some of these should be available from different interfaces,
including GUI(s). However one should be able to interface with the
application at different levels. When Solr gets more complex over time,
care must be taken so it does not get complicated. There might be
numerous more points of entry into a more complex product. It is
necessary to keep things simple as well as providing centralized
configuration possibilities. Following this philosophy, Solr users will
be able to choose their level of interaction.
(In a metaphor, some people prefer using GNU/Linux just by installing a
distro; others compile and become best friends with the command line.)
Eivind
Re: Re: SolrCore as Singleton?
Posted by Tim Archambault <ta...@bangordailynews.net>.
In regard to the comment about lack of an interface, I view this as a
benefit of the tool.
Whether I'm developing with Python, PHP, Coldfusion, .NET, Java, etc.
I can create my own customizable interface. As a coldfusion programmer
with moderate programming capabilities, this tool is perfect for my
needs.
On 9/8/06, Andrew May <am...@ingenta.com> wrote:
> Chris Hostetter wrote:
> > : Nice. Is the same doable under Jetty? (never had to deal with JNDI
> > : under Jetty)
> >
> > i haven't tried it personally, but according to Yoav "reading" JNDI
> > options is part of hte Servlet Spec, and billa found a refrene to
> > useing "<env-entry>" to do so...
> >
> > http://www.nabble.com/Re%3A-multiple-solr-webapps-p3991310.html
> >
> > ...where exactly that option goes in Jetty's configuration isn't something
> > i'm clear on.
> >
>
> <env-entry> values go in web.xml, so it would mean having modified versions of solr.war
> for each collection.
>
> <env-entry> is an optional part of the Servlet spec for standalone servlet
> implementations. The basic version of Jetty does not have any JNDI support, you need to
> use JettyPlus (http://jetty.mortbay.org/jetty5/plus/index.html) for that.
>
> -Andrew
>
Re: SolrCore as Singleton?
Posted by Andrew May <am...@ingenta.com>.
Chris Hostetter wrote:
> : Nice. Is the same doable under Jetty? (never had to deal with JNDI
> : under Jetty)
>
> i haven't tried it personally, but according to Yoav "reading" JNDI
> options is part of hte Servlet Spec, and billa found a refrene to
> useing "<env-entry>" to do so...
>
> http://www.nabble.com/Re%3A-multiple-solr-webapps-p3991310.html
>
> ...where exactly that option goes in Jetty's configuration isn't something
> i'm clear on.
>
<env-entry> values go in web.xml, so it would mean having modified versions of solr.war
for each collection.
<env-entry> is an optional part of the Servlet spec for standalone servlet
implementations. The basic version of Jetty does not have any JNDI support, you need to
use JettyPlus (http://jetty.mortbay.org/jetty5/plus/index.html) for that.
-Andrew
Re: SolrCore as Singleton?
Posted by Chris Hostetter <ho...@fucit.org>.
: Nice. Is the same doable under Jetty? (never had to deal with JNDI
: under Jetty)
i haven't tried it personally, but according to Yoav "reading" JNDI
options is part of hte Servlet Spec, and billa found a refrene to
useing "<env-entry>" to do so...
http://www.nabble.com/Re%3A-multiple-solr-webapps-p3991310.html
...where exactly that option goes in Jetty's configuration isn't something
i'm clear on.
: ----- Original Message ----
: From: Chris Hostetter <ho...@fucit.org>
: To: solr-user@lucene.apache.org
: Sent: Friday, September 8, 2006 1:46:19 AM
: Subject: Re: SolrCore as Singleton?
:
:
: : I am currently in the startup phase of my thesis regarding open source
: : and enterprise search. After having worked at perhaps the leading major
: : enterprise search company, I have the impression that multiple
: : collections is a very common feature (and very sought-after). It is a
: : trend I see not just directly from my work, but most certainly also as a
: : result of enterprise search solutions becoming more common in general.
:
: SolrCore being a singleton doesn't prevent you from having multiple
: collections per JVM -- you just need to run multiple instances of the
: webapp within a single servlet container using JNDI to specify the
: seperate solr.home directories, specifics for doing this in Tomcat are on
: the wiki...
: http://wiki.apache.org/solr/SolrTomcat
:
: : Until this framework is available with its appropriate configuration
: : files, administrator interface and so on in place, it seems a bit
: : unnatural to support multiple collections from the same application
: : instance.
: :
: : Bottom line (for now): I think that users looking for enterprise search
: : solutions must have a simple way of creating multiple collections from
: : within the same application.
:
: Well it's pretty easy right now to make a new collection -- it's
: just two new files (solrconfig.xml and schema.xml)
:
:
:
:
: -Hoss
:
:
:
:
-Hoss
Re: SolrCore as Singleton?
Posted by Otis Gospodnetic <ot...@yahoo.com>.
Nice. Is the same doable under Jetty? (never had to deal with JNDI under Jetty)
Otis
----- Original Message ----
From: Chris Hostetter <ho...@fucit.org>
To: solr-user@lucene.apache.org
Sent: Friday, September 8, 2006 1:46:19 AM
Subject: Re: SolrCore as Singleton?
: I am currently in the startup phase of my thesis regarding open source
: and enterprise search. After having worked at perhaps the leading major
: enterprise search company, I have the impression that multiple
: collections is a very common feature (and very sought-after). It is a
: trend I see not just directly from my work, but most certainly also as a
: result of enterprise search solutions becoming more common in general.
SolrCore being a singleton doesn't prevent you from having multiple
collections per JVM -- you just need to run multiple instances of the
webapp within a single servlet container using JNDI to specify the
seperate solr.home directories, specifics for doing this in Tomcat are on
the wiki...
http://wiki.apache.org/solr/SolrTomcat
: Until this framework is available with its appropriate configuration
: files, administrator interface and so on in place, it seems a bit
: unnatural to support multiple collections from the same application
: instance.
:
: Bottom line (for now): I think that users looking for enterprise search
: solutions must have a simple way of creating multiple collections from
: within the same application.
Well it's pretty easy right now to make a new collection -- it's
just two new files (solrconfig.xml and schema.xml)
-Hoss
Re: SolrCore as Singleton?
Posted by Chris Hostetter <ho...@fucit.org>.
: I am currently in the startup phase of my thesis regarding open source
: and enterprise search. After having worked at perhaps the leading major
: enterprise search company, I have the impression that multiple
: collections is a very common feature (and very sought-after). It is a
: trend I see not just directly from my work, but most certainly also as a
: result of enterprise search solutions becoming more common in general.
SolrCore being a singleton doesn't prevent you from having multiple
collections per JVM -- you just need to run multiple instances of the
webapp within a single servlet container using JNDI to specify the
seperate solr.home directories, specifics for doing this in Tomcat are on
the wiki...
http://wiki.apache.org/solr/SolrTomcat
: Until this framework is available with its appropriate configuration
: files, administrator interface and so on in place, it seems a bit
: unnatural to support multiple collections from the same application
: instance.
:
: Bottom line (for now): I think that users looking for enterprise search
: solutions must have a simple way of creating multiple collections from
: within the same application.
Well it's pretty easy right now to make a new collection -- it's
just two new files (solrconfig.xml and schema.xml)
-Hoss
Re: SolrCore as Singleton?
Posted by Eivind Hasle Amundsen <ei...@ifi.uio.no>.
Chris Hostetter wrote:
> I'm going to sidestep the issue of wether there *was* a good reason for
> it, as well as the "does the singleton pattern make sense for the current
> usage" question and answer what i think is an equally significant
> question: "what are the implications of trying to change it now?" ... the
> biggest i can think of being that SolrConfig is also a static singleton,
> and a *lot* of code in the Solr code base would need to be changed to
> support multiple SolrConfigs ... and without multiple SolrConfigs, there
> really isnt' any reason to have multiple SolrCores.
This actually underlines that my guess was right to a certain extent.
Changing from singleton is not straightforward.
I am currently in the startup phase of my thesis regarding open source
and enterprise search. After having worked at perhaps the leading major
enterprise search company, I have the impression that multiple
collections is a very common feature (and very sought-after). It is a
trend I see not just directly from my work, but most certainly also as a
result of enterprise search solutions becoming more common in general.
However I must say that Solr seems to be approaching the problem from a
very logical angle. What really is missing is a more abstract layer,
call it application framework, that probably will come afterwards
anyway. This will perhaps evolve naturally as part of the Solr project
at a later stage, or perhaps even as a separate open source project
building on Solr.
Until this framework is available with its appropriate configuration
files, administrator interface and so on in place, it seems a bit
unnatural to support multiple collections from the same application
instance.
Bottom line (for now): I think that users looking for enterprise search
solutions must have a simple way of creating multiple collections from
within the same application.
I apologize for my very philosophical e-mail, but I tend to become
somewhat visionary and conceptual after a few beers, and this might not
be the perfect forum for these discussions(?) :)
Eivind
Re: SolrCore as Singleton?
Posted by Chris Hostetter <ho...@fucit.org>.
: Is there a good reason for implementing SolrCore as a Singleton?
I'm going to sidestep the issue of wether there *was* a good reason for
it, as well as the "does the singleton pattern make sense for the current
usage" question and answer what i think is an equally significant
question: "what are the implications of trying to change it now?" ... the
biggest i can think of being that SolrConfig is also a static singleton,
and a *lot* of code in the Solr code base would need to be changed to
support multiple SolrConfigs ... and without multiple SolrConfigs, there
really isnt' any reason to have multiple SolrCores.
-Hoss
Re: SolrCore as Singleton?
Posted by Eivind Hasle Amundsen <ei...@ifi.uio.no>.
> If there is no specific reason for making it a Singleton, I'd vote for
> removing this so that the
> SolrCore(dataDir, schema) constructor could be used to instantiate
> multiple cores.
I agree with your arguments. However (although being new to Solr) there
is more than one way to do it, I think.
To be more specific it seems that using several different indexes with
individual datadirs and schemas is very useful, based on my impression
that many enterprise users seem to want this functionality. It is not
difficult to imagine such a usage pattern or implementation, in its
abstract sense, of Solr for almost all uses.
However (and this is where most you guys should fill me in), it could be
wasteful to run multiple complete instances. Could information be shared
in some way between the instances to save on resources? Perhaps what I
am really trying to say here, is that we have to look at the whole model
when considering how to implement better support for the desired usage
pattern outlined above.
Eivind