Hateburo: kazeburo hatenablog

SRE / 運用系小姑 / Goを書くPerl Monger

Cache::Memcached::Fast::Safe 0.04 was out. It has get_or_set()

I added get_or_set() to Cache::Memcached::Fast::Safe and released as ver. 0.04https://metacpan.org/release/Cache-Memcached-Fast-SafeI saw some people make a module that inherits Cache::Memcached::Fast::Safe only for adding get_or_set(). sa…

Released Kossy-0.23. Improve Performance

Kossy-0.23 gets 2x or more faster. https://metacpan.org/release/KossyI made these changes. Cache Kossy::Request->base. URI->canonical is slow. Use Router::Boom for router Use HTTP::Headers::Fast Optimize Kossy::Response->finalize Benchmark…

Plack::Middleware::Session uses Cookie::Baker

Plack::Middleware::Session 0.21 uses Cookie::Baker for improve performance. Cookie::Baker is simple cookie generator/parser module. https://metacpan.org/release/Plack-Middleware-SessionPrevious version of Plack::Middleware::Session uses Pl…

Released Cookie::Baker to CPAN

I released Cookie::Baker that provides HTTP cookie generator and parserhttp://search.cpan.org/~kazeburo/Cookie-Baker/ https://metacpan.org/release/Cookie-Baker### synopsis use Cookie::Baker; $headers->push_header('Set-Cookie', bake_cookie(…

Monoceros supports accept4(2)

tokuhirom released Linux::Socket::Accept4 that provides accept4(2) Monoceros-0.25 uses accept4 if Linux::Socket::Accept4 is avaliable.accept4(2) can set FD_CLOEXEC and O_NONBLOCK in one system call.Monoceros-0.24 select(16, [4 10], NULL, N…

ISUCON3 予選に参加してきました。無念ばかり残る

isucon3予選に @sugyan @tagomorisとLINE選抜チームを組んで参加しました。共催枠なので結果に関わらず本戦には出れるのですが、結果は総合8位。無念です やったこと sugyanのエントリが詳しいのですが、自分がやったのは nginx(openresty)への入れ替え mysq…

The number of item that memcached-1.4.15 can keep is less than older version?

I decided to downgrade memcached because there was trouble several times in 1.4.15. After downgrading to 1.4.14, the memcached keeps item 7% more than 1.4.15.1.4.15 has a bug around slab allocator? ref: https://code.google.com/p/memcached/…

Nginx gzip and Vary. How to

I want to output "Vary: Accept-Encoding,User-Agent". But gzip_vary only adds Accept-Encoding. "add_header Vary" does not merge headers.My answer is.. location / { gzip on; gzip_disable "MSIE [1-6]\."; gzip_types text/css application/x-java…

xbuildとCartonを利用したPerlアプリケーションのデプロイ環境の構築

最近、新しいサーバでサービスを動かしたりベンチマークを取る場合には、モリスさんのxbuildを使ってるhttps://github.com/tagomoris/xbuildxbuildを使うとローカルの任意のディレクトリにPerl(Ruby,Node.js,PHP,Pythonにも対応)のランタイムを設置してくれ…

Released Plack::Middleware::ServerStatus::Lite 0.30, includes server-status command

I released Plack::Middleware::ServerStatus::Lite 0.30. This version includes `server-status` command.https://metacpan.org/release/Plack-Middleware-ServerStatus-Liteserver-status command is able to display server status without HTTP request…

Released Cache::Memcached::Fast::Safe 0.03, fixed connection leak bug

I released Cache::Memcached::Fast::Safe 0.03 to cpanhttps://metacpan.org/module/Cache::Memcached::Fast::Safeversion 0.02 has a connection leaking bug. Please update if you use this.

Starlet and Monoceros reached 100kreqs/sec

Preforking Plack::Handler, Starlet and Monoceros reached 100kreq/sec on my "Hello World" benchmark. Starlet $ plackup -s Starlet -E produnction --max-workers 40 --max-reqs-per-child 50000 \ -max-keepalive-reqs 10000 -e 'sub{[200,[],["Hello…

Plack < 1.0029 and http_proxy

Plack $ no_proxy=www.cpan.org http_proxy=http://localhost:3941 cpanm --test-only MIYAGAWA/Plack-1.0028.tar.gz --> Working on MIYAGAWA/Plack-1.0028.tar.gz Fetching http://www.cpan.org/authors/id/M/MI/MIYAGAWA/Plack-1.0028.tar.gz ... OK Conf…

Starlet 0.20 supports HTTP/1.1 / Benchmark by wrk

PSGI/Plack HTTP server Starlet 0.20 that was released last week, supports HTTP/1.1.https://metacpan.org/release/Starlet https://github.com/kazuho/StarletPrevious versions of Starlet only support HTTP/1.0 and HTTP/1.0 keepalive, but finally…

MacBookAir 買ったらスグ入れたい!エンジニア必携ツール1個

Secrets

Cache::Memcached::Fast::Safe - preventing memcached injection

Cache::Memcached::Fast::Safe is subclass of Cache::Memcached::Fast. Cache::Memcached::Fast::Safe sanitizes all requested keys for against memcached injection problem. and call disconnect_all automatically after fork for fork-safe.https://m…

Proclet supports $PORT auto assignment in Proclet-0.30

proclet command (foreman for perl) that included in Proclet distribution, now supports auto assignment of $PORT that written in Procfile.https://metacpan.org/release/ProcletIn Procfile web: plackup -p $PORT -a app.psgi admin: plackup -p $P…

Server::Starter 0.13 was released. It supports `start_server --dir /path/to`

In Server::Starter 0.13, --dir option was added to start_server. start_server will do chdir to a specified directory before exec(2). It's useful when you use carton, proclet and deploy tool like capistrano that does rsync all project files…

Furlでサーバへの接続に掛かった時間とレスポンスに掛かった時間を取得する方法

AnyEvent::HTTPの続き package MyFurl::HTTP; use strict; use warnings; use base qw/Furl::HTTP/; use Time::HiRes; sub response_time { if ( @_ > 1 ) { $_[0]->{times} = $_[1]; } $_[0]->{times}; } sub connect : method { my($self, $host, $port, $…

How to keepalive more than one connections with Furl - Furlで2個以上の接続を維持する技

Furl can do keepalive connection by passing connection pool object to connection_pool option, By default, Furl::ConnectionCache is used. But Furl::ConnectionCache can keep only one connection at once. To do keepalive more one connections. …

AnyEvent::HTTPでサーバへの接続に掛かった時間とレスポンスに掛かった時間を取得する方法

深遠な理由で、connect(2) に掛かった時間と、リクエストを送ってレスポンスが得られるまでに掛かった時間を出したい #!/usr/bin/perl use strict; use warnings; use AnyEvent::HTTP; use AnyEvent::Socket; use AnyEvent::DNS::Cache::Simple; use Time::H…

Test::TCP 2.00 !!

Test::TCP 2.00 drops wait_port_sleep and wait_port_retry argument added at 1.28, and adds max_wait option. Test::TCP waits up to max_wait seconds while stretching the sleep time gradually from 0.001 secondshttps://metacpan.org/release/Test…

nginxを1.2.xから1.4.1にアップデートしたらstub_statusのreadingが0になった 

nginxを1.2.xから1.4.1にアップデートしたらstub_statusのreadingが0になった 矢印のところでアップデート。telnetでアクセスしたらreading増えたのでこの数字が意味なくなった訳ではなさそう。 何かしら処理が変わったのかしら..

Starman と Starlet のベンチマークと Accept Serialization

StarmanとStarletの違いはいくつかありますが、Starletにいくつか手を加えたあと、速度はどうなっているのか比較してみた。なお、以下の記事はHello Worldのベンチマークなので、実際のアプリケーションのパフォーマンスにはあまり影響がないと思われます。…

最近のPlack/Starletのパフォーマンス改善まとめ。最大2倍の性能向上

最近のPlackとStarletにはパフォーマンス改善のため次のような変更が加えられています。Plackに対する変更 (カッコ内はバージョン) Plack::Request::query_parameters の最適化 (1.0018) Plack::Middleware::AccessLog に Apache::LogFormat::Compilerの導入…

MacにAlien::RRDtoolでrrdtoolを導入する方法 2013/03/29版

情勢は変化するので、とりあえず現時点版。OSはSnow Leopard。まず rrdtool の依存ライブラリは homebrew でいれる。かならず brew update を行うこと $ brew update $ brew upgradeできれば brew upgrade まで行ってライブラリを最新にしておく。依存ライブ…

Starletのヘッダとボディを合わせて出力する閾値を変更してみる

Starletは小さいコンテンツを出力する時に、ヘッダをボディを一括で出力する機能がある。今(0.17_1)での閾値は 1024byte。これを変更して変化があるかどうかを確認する。変更点は↓の部分。 diff --git a/lib/Starlet/Server.pm b/lib/Starlet/Server.pm inde…

perl-5.8と5.16でStarletのベンチマークを取って比べてみる

perlのバージョン上げて高速化!yay— masahiro naganoさん (@kazeburo) 2013年3月13日の検証をいろいろついでにやってみた。環境は Xeon L5630 (2.13GHz) 4コア8スレッド x 2 なサーバ。ベンチマークをクライアントは同じスペックの別のサーバですperl-5.8は…

Starlet の次期バージョンは少し速くなる

3/8に開発バージョンの0.17_1が出ましたが、このバージョンはひとつ前の0.16に比べて少し高速になっています。 local $SIG{...} = sub {}が使われていた部分を最適化してリクエストの前後でsystem callを減らしました。straceでみると before 23:02:27.21348…

Starletとmod_perlの違い

straceで見てると、acceptしてからリクエスト行を読むまでの処理が違う Starlet 23:40:11.099510 accept(4, {sa_family=AF_INET, sin_port=htons(44565), sin_addr=inet_addr("10.xxx.xx.xx")}, [1562186129334075408]) = 5 23:40:11.269991 ioctl(5, SNDCTL…