- http://www.mysqlops.com/2011/06/14/google-tcmalloc-malloc.html#more-737
二,现在开始介绍在64bit centos 6.3的版本中让nginx使用tcmalloc。需要用到的软件都已经上传到附件中。- # tar xf libunwind-1.0.tar.gz
- # tar xf libunwind-1.0
- #CFLAGS=-fPIC ./configure添加编译参数
- # make CFLAGS=-fPIC
- # make CFLAGS=-fPIC install
这样执行会出现如下错误:
- libtool: install: error: relink `libunwind-setjmp.la' with the above command before installing it
- make[3]: *** [install-libLTLIBRARIES] Error 1
- make[3]: Leaving directory `/down/libunwind-1.0/src'
- make[2]: *** [install-am] Error 2
- make[2]: Leaving directory `/down/libunwind-1.0/src'
- make[1]: *** [install] Error 2
- make[1]: Leaving directory `/down/libunwind-1.0/src'
- make: *** [install-recursive] Error 1
产生这种问题的原因:autotools兼容性的问题,运行命令autoreconf -i -f ,在重新编译安装下。
- #autoreconf -i -f
- #make clean
- #CFLAGS=-fPIC ./configure
- #make CFLAGS=-fPIC
- #make CFLAGS=-fPIC install
四,安装gpperftools:
- #tar xf gperftools-2.0.tar.gz
- # cd gperftools-2.0
- #./configure
- #make && make install
这样安装会会报如下错误:
- cc1plus: warning: unrecognized command line option "-Wno-unused-result"
- ake: *** [stacktrace.lo] Error 1
为什么出现在这种错误,因此是64bit系统,至于更深度的解释,安装说明中有。下面重新编译。
- #make clean
- #./configure --enable-frame-pointers
- #make && make install
- #echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
- #ldconfig
五,编译pcre,使nginx支持http rewrite。
- # tar xf pcre-8.10.tar.gz
- # cd pcre-8.10
- # ./configure
- # make && make install
六,编译nginx
- # tar xf nginx-1.2.3.tar.gz
- # ./configure \
- --with-http_ssl_module \
- --with-http_flv_module \
- --with-http_stub_status_module \
- --with-http_gzip_static_module \
- --http-client-body-temp-path=/var/tmp/nginx/client/ \
- --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
- --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
- --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
- --http-scgi-temp-path=/var/tmp/nginx/scgi \
- --with-pcre \
- --with-google_perftools_module
- # make && make install
7,为gperftools创建线程目录
- #mkdir /tmp/tcmalloc
- #chmod 0777 /tmp/tcmalloc
8,修改nginx的配置文件
- #vim /usr/local/nginx/conf/nginx.conf
- #pid logs/nginx.pid;
- google_perftools_profiles /tmp/tcmalloc;添加这一行
9,启动nginx,并验证tcmalloc有没有正常加载
- # /usr/local/nginx/sbin/nginx
- # lsof -n |grep tcmalloc
- nginx 1893 nobody 9w REG 253,0 0 43018 /tmp/tcmalloc.1893
- nginx 1894 nobody 11w REG 253,0 0 43016 /tmp/tcmalloc.1894
至此已经替换成功。我的瘦服务器配置了nginx,我的ROR应用程序正在它们上运行。在我发布代码更新时运行thinrestart会给我的应用程序带来一些停机时间。我试图弄清楚如何优雅地重启正在运行的Thin实例,但找不到好的解决方案。有没有人能做到这一点? 最佳答案 #Restartjustthethinserverdescribedbythatconfigsudothin-C/etc/thin/mysite.ymlrestartNginx将继续运行并代理请求。如果您将Nginx设置为使用多个上游服务器,例如server{listen80;server
我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e
需求:要创建虚拟机,就需要给他提供一个虚拟的磁盘,我们就在/opt目录下创建一个10G大小的raw格式的虚拟磁盘CentOS-7-x86_64.raw命令格式:qemu-imgcreate-f磁盘格式磁盘名称磁盘大小qemu-imgcreate-f磁盘格式-o?1.创建磁盘qemu-imgcreate-fraw/opt/CentOS-7-x86_64.raw10G执行效果#ls/opt/CentOS-7-x86_64.raw2.安装虚拟机使用virt-install命令,基于我们提供的系统镜像和虚拟磁盘来创建一个虚拟机,另外在创建虚拟机之前,提前打开vnc客户端,在创建虚拟机的时候,通过vnc
A/ctohttp://wiki.nginx.org/CoreModule#usermaster进程曾经以root用户运行,是否可以以不同的用户运行nginxmaster进程? 最佳答案 只需以非root身份运行init脚本(即/etc/init.d/nginxstart),就可以用不同的用户运行nginxmaster进程。如果这真的是你想要做的,你将需要确保日志和pid目录(通常是/var/log/nginx&/var/run/nginx.pid)对该用户是可写的,并且您所有的listen调用都是针对大于1024的端口(因为绑定(
我希望Ruby的解析器会进行这种微不足道的优化,但似乎并没有(谈到YARV实现,Ruby1.9.x、2.0.0):require'benchmark'deffib1a,b=0,1whileb由于这两种方法除了在第二种方法中使用预定义常量而不是常量表达式外是相同的,因此Ruby解释器似乎在每个循环中一次又一次地计算幂常数。是否有一些Material说明为什么Ruby根本不进行这种基本优化或只在某些特定情况下进行? 最佳答案 很抱歉给出了另一个答案,但我不想删除或编辑我之前的答案,因为它下面有有趣的讨论。正如JörgWMittag所说,
我正在尝试从数据库中读取大量单元格(超过100.000个)并将它们写入VPSUbuntu服务器上的csv文件。碰巧服务器没有足够的内存。我正在考虑一次读取5000行并将它们写入文件,然后再读取5000行,等等。我应该如何重构我当前的代码以使内存不会被完全消耗?这是我的代码:defwrite_rows(emails)File.open(file_path,"w+")do|f|f该函数由sidekiqworker调用:write_rows(user.emails)感谢您的帮助! 最佳答案 这里的问题是,当您调用emails.each时,
我有带有gemwebsocket-rails0.7的Rails3.2应用程序。在开发机上,一切正常在生产环境中,我使用Nginx/1.6作为代理服务器,Unicorn作为http服务器。Thin用于独立模式(在https://github.com/websocket-rails/websocket-rails/wiki/Standalone-Server-Mode之后)。nginx配置:location/websocket{proxy_passhttp://localhost:3001/websocket;proxy_http_version1.1;proxy_set_headerUp
Nginx在生产中的重要性通常基于它为慢速客户端提供服务的能力;在RESTfulAPI的设置中,它似乎是生产堆栈的一个不必要的层,尤其是Puma(不像广泛使用的unicorn可以处理nginx工作)。Pumacanallowmultipleslowclientstoconnectwithoutrequiringaworkertobeblockedontherequesttransaction.Becauseofthis,Pumahandlesslowclientsgracefully.HerokurecommendsPumaforuseinscenarioswhereyouexpect
我目前正在运行Foreman在暂存(Ubuntu)上,一旦我开始工作,就会切换到使用upstart。我的Procfile.staging看起来像这样:nginx:sudoservicenginxstartunicorn:bundleexecunicorn-c./config/unicorn.rbredis:bundleexecredis-serversidekiq:bundleexecsidekiq-v-C./config/sidekiq.yml我可以使用以下方法成功启动nginx:$sudoservicenginxstart然而,当我运行$foremanstart时,当其他三个进程成
我正在使用open-uri读取一个声称以iso-8859-1编码的网页。当我读取页面内容时,open-uri返回一个以ASCII-8BIT编码的字符串。open("http://www.nigella.com/recipes/view/DEVILS-FOOD-CAKE-5310"){|f|pf.content_type,f.charset,f.read.encoding}=>["text/html","iso-8859-1",#]我猜这是因为网页中的字节(或字符)\x92不是有效的iso-8859字符。http://en.wikipedia.org/wiki/ISO/IEC_8859-