Ruby: would using Fibers increase my DB insert throughput?
        Posted  
        
            by Zombies
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Zombies
        
        
        
        Published on 2010-04-25T01:36:55Z
        Indexed on 
            2010/04/25
            1:43 UTC
        
        
        Read the original article
        Hit count: 295
        
Currently I am using Ruby 1.9.1 and the 'ruby-mysql' gem, which unlike the 'mysql' gem is written in ruby only. This is pretty slow actually, as it seems to insert at a rate of almost 1 per second (SLOOOOOWWWWWW). And I have a lot of inserts to make too, its pretty much what this script does ultamitely. I am using just 1 connection (since I am using just one thread). I am hoping to speed things up by creating a fiber that will
- create a new DB connection
- insert 1-3 records
- close the DB connection
I would imagine launching 20-50 of these would greatly increase DB throughput. Am I correct to go along this route? I feel that this is the best option, as opposed to refactoring all of my DB code :(
© Stack Overflow or respective owner