This is the demo app of Scout, use it for events or demo for potential customers
- Ruby 2.5.3 (If you're using RVM, you can install it with
rvm install 2.5.3
) - Postgres
- Redis
bundle
bundle exec rake db:create
psql rails_demo_development < data/rails_demo_seed_20190205.dump
(NOTE: rake db:seed
works too, but takes a long time)
SCOUT_DEV_TRACE=true rails server
TOKYO RUBYIST MEETUP 2019-02-06 Pair Programming session
As mentioned in the presentation, fast_jsonapi is a high performance JSON::API serializer. Let's try migrating to it.
The fast_jsonapi documentation provides a good overview of how to use it.
For this task, you'll replace the jbuilder user views (app/views/users/index.json.jbuilder and app/views/users/show.json.jbuilder) with a fast_jsonapi UserSerializer.
You can access this in your browser by visiting http://localhost:3000/users.json and http://localhost:3000/users/1.json for instance.
Scout also can give you a performance overview in development mode! However, as it only works with html responses, you'll need to visit the html views instead (http://localhost:3000/users and http://localhost:3000/users/1).
You'll be able to see the performance tab by clicking the panel in the bottom left corner:
Once you've migrated the application to use fast_jsonapi, you can compare the performance:
rails runner "require 'performance_test'; PerformanceTest.run"
Now's a great chance to talk with your partner about the two approaches. What do you think of the difference in strategies? Do you prefer the more object oriented approach of fast_jsonapi or the declarative approach of jbuilder? What do you think of JSON::API vs the json that jbuilder produces?
We've deployed this application, sent some sample requests to it, and created a shared Scout account you can use. Login from https://scoutapp.com/users/sign_in with the credentials:
- username: rails_demo@scoutapp.com
- password: password
Browse through the results there, and then dive into any other performance issues you can identify.