WEB just finished migrating my sites to a single rails app

Discussion in 'OT Technology' started by biawokauns, Mar 8, 2009.

  1. biawokauns

    biawokauns New Member

    Joined:
    Sep 18, 2001
    Messages:
    19,893
    Likes Received:
    0
    Location:
    Republic of Kalifornia
    the original sites were written in PHP because our dedicated box couldn't run rails for some reason (some shitty p4). when we moved to the new box when traffic grew, there were a bunch of features that needed to be added. I took a look at the PHP and said fuck it, time to migrate!

    it's so fucking easy to go in and make changes now, god ruby as a language is fucking sweet too. i'm kinda interested to see how the server holds up :o the weak point before was sql, but i'm caching the fuck out of objects, so most of the calls don't even hit the db server :bowdown:

    two weeks later, :bowdown:

    i'll go more in depth later, but right now it's bed time :wtc:

    1251 lines of code :o
     
  2. ge0

    ge0 New Member

    Joined:
    Oct 31, 2005
    Messages:
    8,398
    Likes Received:
    0
    Location:
    JERSEY
    have fun scaling it. What makes rails easy to use kills its scalability.

    @presidents = Americans.find:)all, :conditions => { :skin_color => 'BLACK' })

    counter = 1
    @presidents.each do |pres_list|
    puts "#" + counter + " President: " + pres_list.last_name + " " + pres_list.first_name
    counter += 1
    end
     
  3. biawokauns

    biawokauns New Member

    Joined:
    Sep 18, 2001
    Messages:
    19,893
    Likes Received:
    0
    Location:
    Republic of Kalifornia
    you're talking like everybody else who hasn't worked with rails.

    memcached, aggressive caching, and optimized db tables > you. resource are inexpensive these days.
     
  4. ge0

    ge0 New Member

    Joined:
    Oct 31, 2005
    Messages:
    8,398
    Likes Received:
    0
    Location:
    JERSEY

    I work with rails everyday.. MEMcache is alright. We had to move to an in memory database for caching.
     
  5. ge0

    ge0 New Member

    Joined:
    Oct 31, 2005
    Messages:
    8,398
    Likes Received:
    0
    Location:
    JERSEY
    straight from the lead engineer at www.twitter.com

    http://www.radicalbehavior.com/5-question-interview-with-twitter-developer-alex-payne/
     
  6. biawokauns

    biawokauns New Member

    Joined:
    Sep 18, 2001
    Messages:
    19,893
    Likes Received:
    0
    Location:
    Republic of Kalifornia
  7. biawokauns

    biawokauns New Member

    Joined:
    Sep 18, 2001
    Messages:
    19,893
    Likes Received:
    0
    Location:
    Republic of Kalifornia
    just finished up with some optimization and aggressive caching :bowdown:

    every page that gets hit is being cached, dynamic areas are cached as fragments and expire when the predetermined action occurs (voting, rating, new post, etc). and db queries are cached as well.

    with around 600 people online earlier today
    Code:
    top - 16:10:39 up 11:55,  1 user,  load average: 5.26, 6.16, 7.16
    Tasks: 331 total,   2 running, 329 sleeping,   0 stopped,   0 zombie
    Cpu(s): 18.6%us,  1.3%sy,  0.0%ni, 79.2%id,  0.4%wa,  0.1%hi,  0.4%si,  0.0%st
    Mem:   8174408k total,  7689216k used,   485192k free,   218340k buffers
    Swap:  2040244k total,      712k used,  2039532k free,   437080k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                   
    28040 nobody    16   0  271m  73m 3904 R   27  0.9   2:40.01 ruby                                                       
    28080 nobody    16   0  192m  70m 2636 S   21  0.9   0:53.97 ruby                                                       
     3066 mysql     15   0  772m 149m 4396 S   21  1.9  94:18.87 mysqld                                                     
    28103 nobody    16   0  192m  70m 2640 S   20  0.9   1:02.64 ruby                                                       
    29329 nobody    16   0  196m  73m 2860 S   18  0.9  14:05.66 ruby                                                       
    27921 nobody    16   0  192m  71m 2640 S   17  0.9   0:53.63 ruby                                                       
    28074 nobody    15   0  192m  70m 2640 S   14  0.9   0:47.37 ruby                                                       
    28172 nobody    15   0  192m  10m 1800 S    1  0.1   0:03.54 httpd                                                      
    28366 nobody    15   0  192m  11m 3168 S    1  0.2   0:03.23 httpd                                                      
    28524 nobody    15   0  192m  10m 1876 S    1  0.1   0:03.47 httpd                                                      
    28992 nobody    15   0  192m  10m 1812 S    1  0.1   0:03.35 httpd                                                      
    30212 nobody    15   0  192m  10m 1800 S    1  0.1   0:01.59 httpd                                                      
    30550 nobody    15   0  192m  10m 1792 S    1  0.1   0:01.43 httpd                                                      
    30774 nobody    15   0  192m  12m 3164 S    1  0.2   0:01.24 httpd                                                      
    30795 nobody    15   0  192m  10m 1800 S    1  0.1   0:01.22 httpd                                                      
    30841 nobody    15   0  192m  10m 1792 S    1  0.1   0:01.09 httpd                                                      
    30842 nobody    15   0  192m  10m 1792 S    1  0.1   0:01.24 httpd                                                      
    30948 nobody    15   0  192m  10m 1792 S    1  0.1   0:01.07 httpd                                                      
    23255 nobody    15   0  192m  12m 3324 S    0  0.2   0:10.76 httpd                                                      
    28166 nobody    15   0  192m  12m 3320 S    0  0.2   0:03.30 httpd                                                      
    28335 nobody    15   0  192m  11m 2364 S    0  0.1   0:03.30 httpd
    
    to

    Code:
    top - 04:09:18 up 23:53,  2 users,  load average: 0.83, 0.94, 0.78
    Tasks: 221 total,   2 running, 219 sleeping,   0 stopped,   0 zombie
    Cpu(s):  7.4%us,  0.4%sy,  0.0%ni, 92.1%id,  0.0%wa,  0.0%hi,  0.1%si,  0.0%st
    Mem:   8174408k total,  7874896k used,   299512k free,   404152k buffers
    Swap:  2040244k total,    10260k used,  2029984k free,  5754888k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                               
    29246 nobody    16   0  191m  70m 2688 S   19  0.9   0:17.43 ruby                                                                                                                   
    26553 nobody    16   0  194m  71m 2868 S   18  0.9   0:29.47 ruby                                                                                                                   
     3066 mysql     15   0  772m 137m 4216 S   12  1.7 141:14.91 mysqld                                                                                                                 
    26555 nobody    16   0  193m  72m 2660 R    5  0.9   0:25.74 ruby                                                                                                                   
    26654 nobody    16   0  192m  70m 2700 S    5  0.9   0:23.61 ruby                                                                                                                   
     2964 nobody    15   0  212m  32m 4464 S    0  0.4   0:18.12 httpd                                                                                                                  
     9964 nobody    15   0  193m  13m 3956 S    0  0.2   0:13.05 httpd                                                                                                                  
    10319 nobody    15   0  192m  12m 3196 S    0  0.2   0:12.58 httpd                                                                                                                  
    16553 nobody    15   0  193m  12m 3404 S    0  0.2   0:08.28 httpd                                                                                                                  
    17604 nobody    15   0  210m  30m 5024 S    0  0.4   0:07.66 httpd                                                                                                                  
    22278 nobody    15   0  192m  10m 1884 S    0  0.1   0:03.91 httpd                                                                                                                  
    22309 nobody    15   0  209m  29m 4460 S    0  0.4   0:04.39 httpd                                                                                                                  
    22853 nobody    15   0  193m  12m 3728 S    0  0.2   0:03.51 httpd                                                                                                                  
    23426 nobody    15   0  208m  29m 4448 S    0  0.4   0:03.73 httpd                                                                                                                  
    23428 nobody    15   0  209m  29m 4332 S    0  0.4   0:03.71 httpd                                                                                                                  
    23433 nobody    15   0  211m  30m 5040 S    0  0.4   0:03.92 httpd                                                                                                                  
    23645 nobody    15   0  193m  12m 3716 S    0  0.2   0:03.11 httpd                                                                                                                  
    23872 nobody    15   0  208m  29m 4372 S    0  0.4   0:03.61 httpd                                                                                                                  
    24972 nobody    15   0  192m  12m 3392 S    0  0.2   0:02.16 httpd                                                                                                                  
    26179 nobody    15   0  192m  10m 1828 S    0  0.1   0:00.94 httpd                                                                                                                  
    26338 nobody    15   0  192m  10m 1884 S    0  0.1   0:00.76 httpd                                                                                                                  
    26655 root      15   0 12720 1172  800 R    0  0.0   0:01.44 top                                                                                                                    
    
     
  8. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    sick :bowdown:

    are you using passenger?
     
  9. biawokauns

    biawokauns New Member

    Joined:
    Sep 18, 2001
    Messages:
    19,893
    Likes Received:
    0
    Location:
    Republic of Kalifornia
    yessir :bowdown:

    very easy to configure, and I can still rock my old apache settings when I was serving php (since the cached pages are straight html). i'm also using the "enterprise" ruby edition in combination ftw
     
  10. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    I haven't had a need for the enterprise stuff yet, but I hear a lot of good things from converts.

    BTW, that DNA site I had you look at last year is just NOW going to be pushed up into production. So 1 year (and 11ty rails versions) later it's finally going to be used. :rofl: They are the worst company evar. Communication is horrid
     
  11. biawokauns

    biawokauns New Member

    Joined:
    Sep 18, 2001
    Messages:
    19,893
    Likes Received:
    0
    Location:
    Republic of Kalifornia
    if you deploy via passenger, it's worth checking out it's free too :o :hsugh: did it get stuck in some company bureaucracy? shieeeet
     
  12. Shampoo

    Shampoo Rinse & Repost

    Joined:
    May 5, 2004
    Messages:
    60,183
    Likes Received:
    0
    Location:
    California
    interested in learning more, ruby is still a PITA for me.
     
  13. biawokauns

    biawokauns New Member

    Joined:
    Sep 18, 2001
    Messages:
    19,893
    Likes Received:
    0
    Location:
    Republic of Kalifornia
    best bet is to build an app and learn as you go, most people don't go into rails knowing ruby

    follow my blog and check out these basic apps
    http://github.com/ng/crashcourse/tree/master
     

Share This Page