Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up section list migration by optimizing solr queries #5953

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

cjcolvar
Copy link
Member

Only return ids since we're only using ids.

Before:

Benchmark.measure { ActiveFedora::SolrService.query("has_model_ssim:MediaObject AND NOT section_list_ssim:[* TO *]", rows: MediaObject.count).pluck("id") }
/srv/services/avalon_mco-stage-8130/avalon/shared/bundle/ruby/3.2.0/gems/rsolr-2.5.0/lib/rsolr/client.rb:218:in `rescue in execute': Connection refused - {:data=>"rows=196430&q=has_model_ssim%3AMediaObject+AND+NOT+section_list_ssim%3A%5B*+TO+*%5D&qt=standard", :method=>:post, :params=>{:wt=>:json}, :query=>"wt=json", :headers=>{"Content-Type"=>"application/x-www-form-urlencoded; charset=UTF-8"}, :path=>"select", :uri=>#<URI::HTTPS https://XXX.XXX/solr/avalon/select?wt=json>} (RSolr::Error::ConnectionRefused)
/N/dragon/home/app_avalon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/openssl/buffering.rb:214:in `sysread_nonblock': Connection reset by peer (Faraday::ConnectionFailed)
/N/dragon/home/app_avalon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/openssl/buffering.rb:214:in `sysread_nonblock': Connection reset by peer (Errno::ECONNRESET)

After:

Benchmark.measure { ActiveFedora::SolrService.query("has_model_ssim:MediaObject AND NOT section_list_ssim:[* TO *]", fl: [:id], rows: MediaObject.count).pluck("id") }
=> #<Benchmark::Tms:0x00007fe16e33ff70 @cstime=0.0, @cutime=0.0, @label="", @real=19.47818299755454, @stime=0.017693999999999876, @total=0.6288720000000005, @utime=0.6111780000000007>

Only return ids since we're only using ids.
@cjcolvar cjcolvar merged commit c65d675 into develop Jul 24, 2024
2 checks passed
@cjcolvar cjcolvar deleted the cjcolvar-patch-3 branch July 24, 2024 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants