Skip to content

Instantly share code, notes, and snippets.

[GEM_ROOT]/gems/ldp-0.6.4/lib/ldp/client/methods.rb:119 :in `block in check_for_errors`
[GEM_ROOT]/gems/ldp-0.6.4/lib/ldp/client/methods.rb:117 :in `tap`
[GEM_ROOT]/gems/ldp-0.6.4/lib/ldp/client/methods.rb:117 :in `check_for_errors`
[GEM_ROOT]/gems/ldp-0.6.4/lib/ldp/client/methods.rb:53 :in `block in get`
[GEM_ROOT]/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:166 :in `instrument`
[GEM_ROOT]/gems/ldp-0.6.4/lib/ldp/client/methods.rb:33 :in `get`
[GEM_ROOT]/gems/active-fedora-11.1.6/lib/active_fedora/caching_connection.rb:13 :in `get`
/usr/local/lib/ruby/2.3.0/delegate.rb:83 :in `method_missing`
[GEM_ROOT]/gems/active-fedora-11.1.6/lib/active_fedora/initializing_connection.rb:27 :in `get`
[GEM_ROOT]/gems/ldp-0.6.4/lib/ldp/resource.rb:54 :in `get`
[GEM_ROOT]/gems/ldp-0.6.4/lib/ldp/client/methods.rb:119 :in `block in check_for_errors`
[GEM_ROOT]/gems/ldp-0.6.4/lib/ldp/client/methods.rb:117 :in `tap`
[GEM_ROOT]/gems/ldp-0.6.4/lib/ldp/client/methods.rb:117 :in `check_for_errors`
[GEM_ROOT]/gems/ldp-0.6.4/lib/ldp/client/methods.rb:25 :in `block in head`
[GEM_ROOT]/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:166 :in `instrument`
[GEM_ROOT]/gems/ldp-0.6.4/lib/ldp/client/methods.rb:17 :in `head`
/usr/local/lib/ruby/2.3.0/delegate.rb:83 :in `method_missing`
[GEM_ROOT]/gems/active-fedora-11.1.6/lib/active_fedora/initializing_connection.rb:22 :in `head`
[GEM_ROOT]/gems/ldp-0.6.4/lib/ldp/resource.rb:59 :in `head`
[GEM_ROOT]/gems/ldp-0.6.4/lib/ldp/resource.rb:42 :in `new?`
{
"Exif": {
"PixelXDimension": 3100,
"DateTimeDigitized": "2014:01:28 10:58:59",
"PixelYDimension": 2488,
"ColorSpace": 65535
},
"Orientation": 1,
"Content-Type": "image/tiff",
"Output": {},
@jrochkind
jrochkind / overview.md
Created July 18, 2017 14:20
profiling slow sufia show page

Sufia 7.3 curation_concerns/base/show.html.erb

We’ve customized this page, but like the original, it lists all members (for the purpose of this profile all filesets), without pagination, with some metadata and hyperlink actions, along with some cancancan guards for some of them. I’m not sure if the original uncustomized would have exactly the same performance characteristics — it’s possible we’ve added more calls to metadata attributes and generation of hyperlinks than the original.

We have already implemented the Solr fetch n+1 workaround. Adapted from https://github.com/pulibrary/plum/blob/master/app/factories/efficient_member_presenter_factory.rb.

This profile is of a sample work with 200 file set members — with each page of a manuscript being a member, we do have works with 200-400+ members in our actual data. This profile was done with production-like config, and after a few requests were made to warm things up.

This profile is not of the whole action/render, but just wrapped around what I ident

{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "http://173e44ba-166b-4db0-82a4-da0686ec63dc",
"@type": "sc:Manifest",
"label": "[Click to edit label]",
"metadata": [],
"description": [
{
"@value": "[Click to edit description]",
"@language": "en"
namespace :invoke do
# cap <stage> invoke:rake TASK=chf:data_fix:something[,other:task]
desc "Execute a rake task on a remote server"
task :rake do
if ENV['TASK']
tasks = ENV['TASK'].split(',')
on roles(:app) do
within current_path do
@jrochkind
jrochkind / gem_visit.rb
Last active March 14, 2017 04:12
gem_visit command line utility
#!/usr/bin/env ruby
# Call the file just `gem-visit`, not `gem-visit.rb`, and put it in your path
# (maybe you want ~/bin in your $PATH), to be able to do:
#
# . gem-visit name_of_gem
#
# And have a browser window opened pointing to the (preferable, if it can) github
# homepage of the gem, or other gem project page (last resort).
VCR.configure do |c|
c.cassette_library_dir = 'spec/vcr_cassettes'
c.hook_into :webmock # or :fakeweb
c.configure_rspec_metadata!
# Let's you set default VCR mode with VCR=all for re-recording
# episodes. :once is VCR default
record_mode = ENV["VCR"] ? ENV["VCR"].to_sym : :once
c.default_cassette_options = { :record => record_mode }
threads Integer(ENV['PUMA_MIN_THREADS'] || 16), Integer(ENV['PUMA_MAX_THREADS'] || 16)
preload_app!
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
workers Integer(ENV['PUMA_WORKERS'] || 3)
before_fork do
# an action method in a Rails controller, Rails5
def show
futures = 2.times.collect do |n|
Concurrent::Future.execute do
# NEED to wrap here, in case _any_ autoloading is going to happen,
# need to tell Rails so it can be done thread-safely. Or else we might
# get a deadlock.
Rails.application.executor.wrap do
SomeExpensiveNetworkOrIoWorker.new(n).call
end