使用Puma部署Rails项目

Python026

使用Puma部署Rails项目,第1张

Puma是一个基于Ruby的Web Server服务器,与其他Ruby Web服务器不同的是,Puma是为速度与并发而生的。它和Unicorn的很大不同是,Puma主要基于多线程,而Unicorn是基于多进程,所以Puma的内存占用要比Unicorn小很多。(当然基于多线程最大的问题就是线程安全的问题,这个在Ruby1.9之后已经逐步得到比较完美的解决了,Ruby1.8就别指望跑Puma了。)

下面是Puma的官方给出的数据,内存占用占据明显优势,而速度方面也是独占鳌头,所以Puma在部署中越来越流行了。

和unicorn一样,使用Puma之前先在Gemfile中添加:

之后添加配置文件config/puma.rb

关于所有的配置参数,可以在 https://github.com/puma/puma/blob/master/examples/config.rb 里面了解。

https://ruby-china.org/topics/10832

https://ruby-china.org/topics/15140

试试这个方法:

typedef struct lista{

struct lista *next

int data

}list

void insert(list *h)

void del(list *h)

int main()

{

int flag

list *head=(list *)malloc(sizeof(list))

head->next=NULL

while(1)

{