Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: ruby-dev
quick jruby + solr benchmarks
 

Index | Next | Previous | View Flat


goodieboy at gmail

Nov 25, 2008, 3:04 PM


Views: 2602
Permalink
quick jruby + solr benchmarks

I'm starting to experiment with benchmarks/jruby + solr and just wanted to
get this out there -- getting ready for a week vacation :)

In my solr-ruby 'refactoring' progress, I'm finding some interesting results
and will try to post in the next few weeks.

This is jruby 1.1.4 and solr 1.3 (empty index) -- using the standard Ruby
"Benchmark" library.

The script:

#

require 'java'
require 'benchmark'

solr_dist_root = File.expand_path(File.join(File.dirname(__FILE__), '..',
'apache-solr-1.3.0'))
solr_home = File.join(solr_dist_root, 'example', 'solr')

def require_jars(dir)
jar_pattern = File.join(dir,"**", "*.jar")
jar_files = Dir.glob(jar_pattern)
jar_files.each {|jar_file| require jar_file}
end

def hash_to_params(hash_params)
import org.apache.solr.common.params.ModifiableSolrParams
query = ModifiableSolrParams.new
query.instance_eval do
alias _add add
def add(field, values)
_add(field.to_s, (values.is_a?(Array) ? values :
[values]).to_java(:string))
end
end
hash_params.each_pair do |k,v|
query.add k, v
end
query
end

require_jars(File.join(solr_dist_root, "lib"))
require_jars(File.join(solr_dist_root, "dist"))

# HttpCommons
def http_commons
@http_commons ||= (
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer
import org.apache.solr.common.params.MapSolrParams
solr = CommonsHttpSolrServer.new("http://localhost:8983/solr")
)
end

# EmbeddedSolrServer
def embedded(solr_home)
@embedded ||= (
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer
import org.apache.solr.core.CoreContainer
import org.apache.solr.core.CoreDescriptor
import org.apache.solr.client.solrj.SolrQuery
core_name = 'main-core'
container = CoreContainer.new
descriptor = CoreDescriptor.new(container, core_name, solr_home)
core = container.create(descriptor)
container.register(core_name, core, false)
solr = EmbeddedSolrServer.new(container, core_name)
)
end

query = {'qt' => 'standard', 'q'=>'ipod', 'facet.field' => 'cat'}
params = hash_to_params(query)

max = 1000

Benchmark.bm do |x|
x.report 'http commons' do
max.times do
http_commons.query(params)
end
end
x.report 'embedded' do
max.times do
embedded(solr_home).query(params)
end
end
end

# THE RESULTS

# http commons
# 4.634000 0.000000 4.634000 ( 4.633849)
# 4.454000 0.000000 4.454000 ( 4.453764)
# 3.908000 0.000000 3.908000 ( 3.907367)

# embedded
# 2.152000 0.000000 2.152000 ( 2.152226)
# 2.191000 0.000000 2.191000 ( 2.191359)
# 2.083000 0.000000 2.083000 ( 2.082696)

Subject User Time
quick jruby + solr benchmarks goodieboy at gmail Nov 25, 2008, 3:04 PM
    Re: quick jruby + solr benchmarks jamie at dangosaur Nov 25, 2008, 4:13 PM
        Re: quick jruby + solr benchmarks goodieboy at gmail Nov 25, 2008, 9:08 PM
        Re: quick jruby + solr benchmarks goodieboy at gmail Nov 25, 2008, 9:10 PM
        Re: quick jruby + solr benchmarks erik at ehatchersolutions Nov 25, 2008, 11:56 PM
    Re: quick jruby + solr benchmarks erik at ehatchersolutions Nov 26, 2008, 12:28 AM
    Re: quick jruby + solr benchmarks goodieboy at gmail Nov 26, 2008, 6:54 AM
    Re: quick jruby + solr benchmarks erik at ehatchersolutions Nov 26, 2008, 7:10 AM
    Re: quick jruby + solr benchmarks erik at ehatchersolutions Nov 26, 2008, 7:34 AM
    Re: quick jruby + solr benchmarks goodieboy at gmail Nov 26, 2008, 9:06 AM
    Re: quick jruby + solr benchmarks jamie at dangosaur Nov 30, 2008, 10:38 AM
        Re: quick jruby + solr benchmarks goodieboy at gmail Dec 3, 2008, 7:05 AM
    Re: quick jruby + solr benchmarks jamie at dangosaur Dec 3, 2008, 8:41 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.