網頁

2016年7月14日 星期四

Test transaction page performance

Usually we test web page performance. Maybe test 1000 with 5 concorrent.
If we test a transaction page performance. Will left many ugly transaction data.
So we can desgin a dryrun mode. below is ruby on rails sample.


  class PurchasesController < ApplicationController
    def create

      ActiveRecord::Base.transaction do
        # This do purchase
        raise ActiveRecord::Rollback if params[:dryrun] # when dryrun then rollback.
      end

    end
  end

2016年7月13日 星期三

Ruby method / block / yield / Proc / lambda 全面解釋

http://railsfun.tw/t/method-block-yield-proc-lambda/110

2016年7月12日 星期二

Nginx Reverse proxy from VirtualHost to VirtualHost

www.demo.com DNS is go to Server1. /and Reverse proxy to Server2 by server2.demo.com . But Server2 need to known www.demo.com. So we need set header by proxy_set_header.

**Server1**
```
server {
  listen 80;
  server_name www.demo.com;

  location / {
      proxy_set_header Host $host;
      proxy_pass http://server2.demo.com/;
  }
}

```


**Server2 server2.demo.com**
```
server {
    listen 80;
    server_name www.demo.comt;
    root /opt/www/;
    index index.html index.htm;
}
```