Showing posts from July, 2015

Difference between PATCH and PUT requests

PATCH does a partial update and PUT is used to update the whole resource.

Lets take an example

If PATCH request submitted with 2 fields for a resource with 8 fields, then only those 2 fields are updated and for PUT request the 2 fields are updated and others are set to their default/existing values.

Apache Benchmark for load testing

Apache Bench is a great load testing tool for web servers

Here are the following steps

1. Install Apache Bench
sudo aptitude install apache2-utils
2. Run Apache Bench

The following line uses keepalive for 10,000 connections, at a concurrency of 100 and a timeout of 20 seconds. Be sure to end root domains with a slash.

ab -k -n 10000 -c 100 -t 20

View logger output in rails console

First you need start the console and then assign rails logger it to use standard out.
rails c >> Rails.logger = >> User.class_method_to_debug You can use similar approach to debug rake tasks etc. You can find more information here Debugging rails applications