Consider a 10% sales tax.
Line Item 1 (Quantity 1) @ $0.04 = $0.04
Line Item 2 (Quantity 1) @ $0.04 = $0.04
shipping_category = Spree::ShippingCategory.create! name: 'default' | |
20.times { |i| Spree::StockLocation.create! name: i.to_s } | |
ActiveRecord::Base.no_touching do | |
10_000.times do | |
product = Spree::Product.create! name: SecureRandom.hex, price: 20, shipping_category: shipping_category | |
rand(1..10).times do | |
variant = Spree::Variant.create! product: product | |
variant.stock_items.shuffle.first(rand(1..20)).each { |stock_item| stock_item.update_columns(count_on_hand: rand(1..1000)) } | |
end | |
end |
Started GET "/api/products?token=e3b20b6dad8521135961c839e4a27877567c303b9460470a" for 10.0.0.231 at 2015-02-24 10:34:43 -0500 | |
ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations" | |
Processing by Spree::Api::ProductsController#index as JSON | |
Parameters: {"token"=>"e3b20b6dad8521135961c839e4a27877567c303b9460470a"} | |
Spree::User Load (0.9ms) SELECT "spree_users".* FROM "spree_users" WHERE "spree_users"."deleted_at" IS NULL AND "spree_users"."spree_api_key" = $1 LIMIT 1 [["spree_api_key", "e3b20b6dad8521135961c839e4a27877567c303b9460470a"]] | |
(0.9ms) SELECT "spree_roles"."name" FROM "spree_roles" INNER JOIN "spree_roles_users" ON "spree_roles"."id" = "spree_roles_users"."role_id" WHERE "spree_roles_users"."user_id" = $1 [["user_id", 1]] | |
(0.8ms) SELECT COUNT(*) FROM "spree_roles" INNER JOIN "spree_roles_users" ON "spree_roles"."id" = "spree_roles_users"."role_id" WHERE "spree_roles_users"."user_id" = $1 AND "spree_roles"."name" = $2 [["user_id", 1], ["name |
Started GET "/api/products?token=e3b20b6dad8521135961c839e4a27877567c303b9460470a" for 10.0.0.231 at 2015-02-24 10:34:43 -0500 | |
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m | |
Processing by Spree::Api::ProductsController#index as JSON | |
Parameters: {"token"=>"e3b20b6dad8521135961c839e4a27877567c303b9460470a"} | |
[1m[35mSpree::User Load (0.9ms)[0m SELECT "spree_users".* FROM "spree_users" WHERE "spree_users"."deleted_at" IS NULL AND "spree_users"."spree_api_key" = $1 LIMIT 1 [["spree_api_key", "e3b20b6dad8521135961c839e4a27877567c303b9460470a"]] | |
[1m[36m (0.9ms)[0m [1mSELECT "spree_roles"."name" FROM "spree_roles" INNER JOIN "spree_roles_users" ON "spree_roles"."id" = "spree_roles_users"."role_id" WHERE "spree_roles_users"."user_id" = $1[0m [["user_id", 1]] | |
[1m[35m (0.8ms)[0m SELECT COUNT(*) FROM "spree_roles" INNER JOIN "spree_roles_users" ON "spree_roles"."id" = "spree_roles_users"."role_id" WHERE "spree_roles_users"." |
Goals
Areas of Performance Problems
# app/mailers/order_mailer_decorator.rb | |
Spree::OrderMailer.class_eval do | |
helper :application | |
end |
SELECT COUNT(*) | |
FROM "spree_products" | |
LEFT OUTER JOIN "spree_variants" ON "spree_variants"."product_id" = "spree_products"."id" AND "spree_variants"."deleted_at" IS NULL | |
WHERE "spree_products"."deleted_at" IS NULL | |
AND spree_variants.id NOT IN (SELECT variant_id FROM spree_well_amy_variant_lifestyles WHERE "lifestyle_id" IN (1, 2, 3, 4)); |
null:null:in `null` | |
null:null:in `null` | |
null:null:in `null` | |
null:null:in `null` | |
null:null:in `null` | |
null:null:in `null` | |
null:null:in `null` | |
null:null:in `null` | |
null:null:in `null` | |
null:null:in `null` |
require 'syslog' | |
class Unicorn::Syslog | |
def initialize | |
Syslog.open | |
end | |
def debug(msg) | |
Syslog.debug(msg) | |
end |
# Logfile created on Thu Jul 25 17:59:37 +0000 2013 by logger.rb/1.2.6 | |
[2013-07-25T17:59:37+00:00] INFO: *** Chef 11.4.4 *** | |
[2013-07-25T17:59:38+00:00] DEBUG: Building node object for cupcake.localdomain | |
[2013-07-25T17:59:38+00:00] DEBUG: Extracting run list from JSON attributes provided on command line | |
[2013-07-25T17:59:38+00:00] INFO: Setting the run_list to ["opsworks_custom_cookbooks::load", "opsworks_custom_cookbooks::execute"] from JSON | |
[2013-07-25T17:59:38+00:00] DEBUG: Applying attributes from json file | |
[2013-07-25T17:59:38+00:00] DEBUG: Platform is amazon version 2013.03 | |
[2013-07-25T17:59:38+00:00] INFO: Run List is [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]] | |
[2013-07-25T17:59:38+00:00] INFO: Run List expands to [opsworks_custom_cookbooks::load, opsworks_custom_cookbooks::execute] | |
[2013-07-25T17:59:38+00:00] INFO: Starting Chef Run for cupcake.localdomain |