Beginner's Guide to Partitioning vs. Sharding in Postgres | Claire Giordano | PGConf EU 2023
When increasing concurrency by using a multi-threaded web server like Puma, or multi-process web server like Unicorn, you must be aware of the number of connections your app holds to the database and how many connections the database can accept. Each thread or process requires a different connection to the database. To accommodate this, Active Record provides a connection pool that can hold severa
随分長いことブログ放置してしまったのだけどネタ見付けたので久々の記事。 UnicornはPassengerより遅かった? なんかTwitterで「アクセス少ないときはPassengerよりUnicornのが速いのに、アクセス多くなってきたらその逆になった」って話をみかけたので、それ単にUnicornのworkerが足りないんじゃないの、と返したのだけど、どういうことかという話を少しまとめる。 まず、Unicornのworkerは1プロセスにつき1度に1リクエストしか処理しない。だから例えば、凄い大雑把な計算だけど、平均50msくらいでレスポンスを返すアプリだとすれば、1workerは20req/secくらいは返せるかなと見積もって、ピーク時に100req/secくらいアクセスがありそうだったらworkerを5個くらい立てとくかな、足んなかったらもうちょっとかな、みたいに考える。実際どんくら
先月、heroku の推しサーバが unicorn から puma に変わったという発表がありました。unicorn だとスロークライアントの影響を受けやすいというのが理由なようです。 もう少し詳しく調べてみましょう。 そもそもスロークライアントってなに その名の通り遅い回線のクライアントです。3G環境のモバイル端末などが該当します。 「unicorn だとスロークライアントの影響を受けやすい」とは unicorn はプロセスモデルのサーバであり、blocking I/O モデルを採用しています。つまり、クライアントとの通信中プロセスが専有されるということです。 例えば unicorn がワーカプロセスを3つ立ち上げていて、そこへ通信完了に10分かかるようなスロークライアントが3つ接続されたら…、続くクライアントはスロークライアントの通信が完了するまで実行を待たなければならなくなります。プ
2010.07.09 次世代Ruby on RailsサーバーUnicorn(汎用のRackアプリケーションサーバ)を使ってみた 2010.07.20追記: prefixを指定した運用も可能でした。ご指摘頂きありがとうございます。 2010.07.28追記: 関連記事「RailsサーバUnicornを飼いならす! 運用時の便利技」へのリンクを張りました。 Railsサーバはたくさんあってややこしいですね! 最近さらにUnicornというものが頭角を表してきたようで、Twitterやgithubも使っているようなので使ってみましたので、特徴や使い方などレポートしてみたいと思います。 このブログの他にもEngine Yardのブログ記事「Everything You Need to Know About Unicorn」やgithubの記事「Unicorn!」が非常に参考になると思いますので、
構築を試みたときに調べたことなどなど なぜunicorn + nginx? unicornは汎用のRackアプリケーションサーバ。Railsからもsinatraからも使える。 unicornだけでも、任意のポートをlistenすればwebサーバーとして使えるが、 以下のようなメリットがあるため、本番ではnginxをリバースプロキシとして 前に立ててからリクエストをunicornに流すのが良い 画像やcssなどの静的ファイルはnginxで高速に返せる リクエストをバッファリングして受信完了してからunicornにリクエストを 投げるため、遅い回線(3Gなど)で接続が来た時にunicornの ワーカプロセスの待ち時間を削減できる 動作原理はgithubの運用例が記載された以下のドキュメントが詳しい https://github.com/blog/517-unicorn まずは、unicornだ
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く