From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: * X-Spam-ASN: AS33070 50.56.128.0/17 X-Spam-Status: No, score=1.0 required=3.0 tests=AWL,HK_RANDOM_FROM, MSGID_FROM_MTA_HEADER,TVD_RCVD_IP shortcircuit=no autolearn=no version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: Re: How to manage growing memory with Rainbows! Date: Thu, 14 Feb 2013 20:28:28 +0000 Message-ID: <20130214202828.GB23895@dcvr.yhbt.net> References: <20130212050021.GA18443@dcvr.yhbt.net> <20130214071512.GA10890@dcvr.yhbt.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1360873711 9305 80.91.229.3 (14 Feb 2013 20:28:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Feb 2013 20:28:31 +0000 (UTC) To: Rainbows! list Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Thu Feb 14 21:28:53 2013 Return-path: Envelope-to: gclrrg-rainbows-talk@m.gmane.org X-Original-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Delivered-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.ruby.rainbows.general:451 Archived-At: Received: from 50-56-192-79.static.cloud-ips.com ([50.56.192.79] helo=rubyforge.org) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U65QK-0002vw-Uf for gclrrg-rainbows-talk@m.gmane.org; Thu, 14 Feb 2013 21:28:53 +0100 Received: from localhost.localdomain (localhost [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id EF8142E076; Thu, 14 Feb 2013 20:28:33 +0000 (UTC) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id 4B7832E076 for ; Thu, 14 Feb 2013 20:28:31 +0000 (UTC) Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 555F41F442; Thu, 14 Feb 2013 20:28:29 +0000 (UTC) Claudio Poli wrote: > I have few more questions before definitely make the switch if you don't mind. > > ActiveRecord/Redis. > This is the configuration I'm trying out in staging: http://pastie.org/private/zepmdeduvlrvtdkc32unnq > > Is there something special that should I know about AR connection pool and Rainbows! + Threadpool? My pool in database.yml is 30. As long as your database can handle the number of connections you have, you're probably fine. Keep in mind you'll have 30 connections per-process (not per-thread), so take that into account if you need to change the process count or start an upgrade with SIGUSR2. > After a small load test currently I'm sitting around 60/80 connections, which is kinda expected given that also Sidekiq is in action. > > I don't like the global $redis connection. Can you, or anyone else, offer any advice how to improve that, if you use it in your projects? > The goal was to keep a connection alive in a single process due to the sheer number of commands that can be put in redis as consequence of actions, but now that I'm using threads it probably needs to be changed. > The cost however for opening a new connection seems high, I was reading this: https://groups.google.com/forum/?fromgroups=#!topic/redis-db/xcz5MXykXdk I have no experience using Redis, but I know it's a TCP-based service. The easiest might be a Thread-local connection with ThreadPool: def redis Thread.current[:my_app_redis] ||= Redis.new(url: url) end This won't work well for ThreadSpawn. _______________________________________________ Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org http://rubyforge.org/mailman/listinfo/rainbows-talk Do not quote signatures (like this one) or top post when replying