Thursday 17 December 2015

nginx: See Active connections / Connections Per Seconds

How do I monitor my nginx server status and connections requests per seconds under Linux or Unix like operating systems?

nginx server has a module called HttpStubStatusModule. This module provides the ability to get some status from nginx. You will get the following information:
  1. Number of all open connections.
  2. Stats about accepted connections.
  3. Connections per second and so on.

Configuration

Edit nginx.conf file:
# vi nginx.conf
Add or append the following in context location:
 
   location /nginx_status {
        # Turn on stats
        stub_status on;
        access_log   off;
        # only allow access from 192.168.1.5 #
        allow 192.168.1.5;
        deny all;
   }
 
Save and close the file. Reload nginx server:
# service nginx reload
OR
# nginx -s reload

Test it

Open a web-browser and type the following url:
http://your-domain-name-here/nginx_status
OR
http://ip.address.here/nginx_status
Sample outputs:
Fig.01: nginx Status Monitor with HttpStubStatusModule
Fig.01: nginx Status Monitor with HttpStubStatusModule

Where,
  1. 586 = Number of all open connections
  2. 9582571 = Accepted connections
  3. 9582571 = Handled connections
  4. 21897888 = Handles requests




Sunday 13 December 2015

Sunday 6 December 2015

The Recipe for the World's Largest Rails Monolith by Akira Matsuda

The Recipe for the World's Largest Rails Monolith


by Akira Matsuda



Kage (kah-geh) is a shadow proxy server to duplex HTTP requests

Kage (kah-geh) is a shadow proxy server to duplex HTTP requests


https://github.com/cookpad/kage

Kage (kah-geh) is an HTTP shadow proxy server that sits between clients and your server(s) to enable "shadow requests".
Kage can be used to duplex requests to the master (production) server and shadow servers that have newer code changes that are going to be deployed. By shadowing requests to the new code you can make sure there are no big/surprising changes in the response in terms of data, performance and database loads etc.
Kage is built with EventMachine and em-proxy and all shadow requests are done asynchronously, while responses from master are sent back to the client without blocking the network, so clients will never notice any delays even when shadow traffic is made.
You can customize the behavior of Kage with simple callbacks, when it chooses which backends to send shadow requests to (or not at all), appends or deletes HTTP headers per backend, and examines the complete HTTP response (including headers and body).

RRRSpec

RRRSpec enables you to run RSpec in a distributed manner.
This is developed for the purpose to obtain the fault-tolerance properties to process-failures, machine-failures, and unresponsivenss of processes in the automated testing process.
RRRSpec is used in production as a CI service, running 60+ RSpec processes concurrently, and it undergoes those failures, which include lots of rb_bugs, assertion errors, and segmentation faults.

https://github.com/cookpad/rrrspec

SwitchPoint

Switching database connection between readonly one and writable one.


https://github.com/eagletmt/switch_point


Suppose you have 4 databases: db-blog-master, db-blog-slave, db-comment-master and db-comment-slave. Article model and Category model are stored in db-blog-{master,slave} and Comment model is stored in db-comment-{master,slave}.

Quine Relay

This is a Ruby program that generates Scala program that generates Scheme program that generates ...(through 100 languages in total)... REXX program that generates the original Ruby code again.

https://github.com/mame/quine-relay

How Digital Disruption Is Redefining Industries


Digital Vortex
How Digital Disruption Is Redefining Industries

http://www.imd.org/uupload/IMD.WebSite/DBT/Digital_Vortex_06182015.pdf