176 points · by ahmicro · 15y ago · 93 comments
It's a competitive advantage for us, we move faster then the rest of the market.
My current startup has a Shopify-like architecture which is what I'm counting on to help me if I ever need to scale fast.
So I think the first question you have to ask yourself when considering scaling is: what is my architecture like?
That is not a scalable solution. Yes, it'll get you up and running out of the box, but as you keep spinning up servers to host each store and it's database you'll have to keep adding exponential resources (hardware, software, meatware) to the problem and keep you from achieving economies of scale.
Instead of "Rails doesn't scale" we should say "Rails runs on Ruby which means that it will consume significantly more CPU and more memory* compared to something else"
In my case, 1 extra server (my estimate) was a small price to pay for developer happiness.
* unless you are running JRuby
I'm reading a great book called Service-Oriented Design with Ruby and Rails, by Paul Dix. He states a lot of the issues that our team is running into with a monolithic app. Seems also that these issues can apply to other frameworks outside of Rails (I've run into some of these same issues years ago with Java web apps).
The main point of the book is figuring out how to abstract out various layers of the app into standalone services. I've talked to people about this and a lot of the time they recoil at the fact that you would increase the complexity of the app by adding yet more parts (services) that require separate machines, deployment dependencies, and their own data stores. However, looking at big sites like Amazon or Twitter shows how one needs and can break apart their systems to make it easier for developers to focus on particular pieces as well as increase system performance.
I'm going to be joining a new startup this year as the technology lead and all these things are on the table. I'm evaluating node, some NoSQL dbs, some cloud paas', etc. I'm also going to be designing from the beginning fast fail and services - or at least an architecture that makes it fairly easy to start migrating parts of the system over to their own standalone services should the need arise. I don't think you can plan for everything, but with the way technology is moving forward and the tools available today, you need to keep SOA at least in the back of your mind.
"If you can make up a website that has a higher traffic than Twitter ... it's a great success of business ... so you have money ... so you're safe to hire the Java programmer to replace it. [laughs]"
http://ontwik.com/ruby/ruby-2-0-what-we-want-to-accomplish-i...
We've migrated some key parts out to HTTP services written in Scala, Java, or node.js.
Ruby will give you a significant time to market advantage especially if you are a startup.
If twitter has (some of) the best ruby developer (mentioned somewhere at the end of the video), why have they neglected JRuby? Why is it no option? For legacy code with native extensions this makes sense. But is jruby slower, more memory hungry on the JVM then scala or clojure? I always though that JRuby was one of the more performant languages on the JVM?
Apart from that it was an interesting talk.
http://shootout.alioth.debian.org/u32/benchmark.php?test=all...
But citing the Alioth.Debian benchmarks? Really?
Dude, take a look at the source-code of those benchmarks sometimes -- they are completely useless ;)
Say what you think is wrong with the source-code of particular programs.
You think the Ruby code could be faster, and thus the comparison is skewed? Go ahead and help everyone understand by improving it.
I've been using rails for almost 7 years now (holy crap) and run a medium-sized site on it. It works just fine, but if I were starting from scratch today, I would still use Rails, but I'd run it on JRuby.
I doubt their story would have been much rosier if had they gone with Spring MVC, Hibernate, and Oracle from the start.
The minute you start moving away from CRUD based application design and moving into SOA, you're already signing up for a significant rewrite, even if you stick with the same platform.
Punch Line from Link:
"There’s a very real chance that invokedynamic could improve JRuby performance many times, putting us on par with our statically-typed brothers like Java and Scala. And that means you can write Ruby code without fear. Awesome."
A little off topic: as a consultant it seems like the demand for Clojure was been tremendous: Clojure is a nice language and very performant. It will be really interesting to see how much large speed improvements in JRuby will cut into Java's, Clojure's and Scala's developer market-share.
http://anonscm.debian.org/viewvc/shootout/shootout/website/w...
* Summize brought Scala
* BackType brought Clojure
Has anyone noticed that pattern elsewhere?
As a pragmatic approach, a half century of software engineering says that you should write the code first and worry about making it faster only if it is too slow. Donald Knuth is right: Premature optimization is the root of all evil. Don’t merely let the VM performance metric blind you to this fundamental truth. If you are chasing for a performing language, Java/Scala is not your ultimate solution, C/C++ is, even Erlang.
I actually don’t see a problem with “performance” emerging as the requirement in the Ruby world sooner than others, say Java/Scala, because this “sooner” is very contextual and depends a lot on the implementation. To give you more info, GitHub is on RoR since it started, and till now they haven’t hit the so-called “Rails does not scale” point ( http://teachmetocode.com/podca... ). So are many other projects. Besides, think about Twitter, they only recently try to port everything to the JVM, after Rails has served them a couple years. All these facts tell you, this “sooner” may never happen to your own app, and most importantly, Rails can scale, although it may not scale as well as others! But once you hit the point where Rails, or Ruby in general, doesn't meet your performance requirement (assuming you are lucky enough to build another Twitter), do what Twitter suggests you to do in the video. Is that too late? Not at all. Because by then, you have the resources to do whatever you want, even inventing a VM that is more performing than JVM.
To summarize, the Ruby VM was fast yesterday, is still fast today, and will be faster tomorrow. In 90% of the cases, it's just fast enough. Do I need the performance gain by switching to JVM? Don't know yet. It'd be better to let the market drive you. Does Rails provide the agility I want to start a project? 100% hell yeah!
So your inbound load is 7000 tweets/sec or roughly 250 MBit/s (assuming 4k per tweet). Then you fan that out to (assuming) 20 append-only mailboxes on average.
Perhaps my assumptions are far off, but I'm only arriving at a couple GBit/s here and a low two digit number of terabytes/storage per year.
This sounds like "a couple racks" to me, not like "a couple datacenters".
http://www.slideshare.net/nkallen/q-con-3770885
Now, at the time they were doing peak 2000 tweet/s. The fan-out was 1.2M deliveries a second... So if we go with the current 600:1 ratio at 7000/s, that's about 4.2M/s. I actually know it's much higher now since I work there but other things to consider is we have a large data warehouse, search, API, pipelines to external parties for the firehose, logging at terabytes an hour, in-house metric collection doing 3M writes/s, etc.
http://www.scribd.com/doc/59830692/Cassandra-at-Twitter
It add's up very fast.
People also have opinions about java(scala/clojure) vs javascript from a language preference standpoint. I think it is too early to tell what impact this will have.
However, many developers I know seem to have a strong distaste for Java, the JVM, and the ecosystem around both. I think several of those folks would look to node, erlang, or possibly even golang (if it gets faster) simply to avoid using java.
Back-end developers seem to (maybe?) prefer to use Java.
People are still using C and C++ to write low level code. Databases, package managers, games, etc. Then there are the 'application developers' as you named them, writing http service endpoints, web apps, and the like.
It seems java still owns the colossal corporate stacks. I hear things like "it is easier to hire" and "java is faster/better for extreme large scale". If you think about all the languages and tools available, only the first makes much sense.
* C/C++/D is faster than java.
* statically compiled code is easier to deploy.
* Erlang is arguably more scalable than java.
* Haskel/Ada is 'safer' than java.
* I think several languages are more fun to write in than java. Ruby, python, golang, coffeescript, etc, etc.
So java may not be the best language for large scale, but maybe one of the best or good enough? When combined with the first point of ease of hiring, I can certainly see why large companies are attracted to it. If your language of choice lends itself to your workers being more easily replaceable, then as a company that is probably better/safer.
Other than that, I can't see why someone would prefer to use java. I don't work in/at/for huge companies though.
I admit that my own personal 'java bias' is based on dated interactions with java. Whenever I hear 'java' I think: good performance (vm), eats memory like candy, painful ecosystem of xml files and outdated/abandoned random libraries. I have tried dabbling in scala, and while I enjoyed the language to a fair extent, I still found myself wrestling with the JVM and the ecosystem (library version incompatibilities, obscure compiler errors, namespace wrangling, etc).
Like he states at the end of the video, when describing the 7000+ tpm during the WWC:
"...we do things like Forex spikes upon our standard baseline growth. So right now the JVM is really the only mechanism that we can build upon that gives us the flexibility to do something like that."
when you need many concurrent users then dont use ROR but use JVM or C++ or Scala instead,
if you need to build a fast prototype build on ROR or PHP etc.