Skip to content

u/badave

In this archive from May 2008 to Nov 2013

0
posts
19
comments
0
media
46
score

I've been working on a site with > 2 million daily actives. I wrote all the code for the backend and there is a lot of heavy backend processing as well. Everything had to be fast with this one and everything had to scale. MySQL was actually completely out of the question because it's just too slow and caching wasn't a good option because the keys would have been invalidated just as fast as they were created.

A little background: I've coded in PHP, ruby, and Node.js and I've done a number of big projects in the first two and a few smaller projects in Node. The LAMP stack work I've done scaled to 300k DAU no problem for the bigger project but involved a bit of caching and used index servers to make sharding simpler. While PHP is alright, and node gets interesting to manage at a bigger size and has many challenges with respect to how long its been in development and is harder to code effectively in, Rails is almost seemingly perfectly built for any development work.

We went with Rails and the database we chose was Redis because I had used it previously. It's fast. It's very fast. However, it's single threaded so if you do anything that is extremely CPU intensive with a huge number of threads pinging it at once, you have to realize that you're going to have to spread the CPU cycles over multiple redis shards. There are a few ways to do that, but you have to be able to realize that there are going to be bottlenecks and that it will be up to you to determine what those bottlenecks are and the best way of getting rid of them.

Looking back at it, you can write it in any language, but I've found that Rails and Redis have been quite a duo. There are some places where I still use MySQL however, simply because Redis makes it very difficult to sort anything. But overall, I'd highly recommend the nginx-rails-redis stack.

I'm sorry that this is in the PHP subreddit. I'm still a PHP programmer, but I think I've been converted.

4 points

Did you figure this out? It seemed to me like you needed a While($row = $stmt->fetch()) and a few $row[] references but I could just be drunk.

1 points

Whoever wrote this has too much time on his or her hands and, on top of that, has not read comics like Garfield or Baldo, which actually do suck.

0 points

End of this list.

Back to top

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.