Live data from Hacker News

Pinterest Architecture Update - 18M Visitors, 10x Growth, 12 Employees, 410 TB

highscalability.com

71–80 of 88 posts

Re: Pinterest Architecture Update - 18M Visitors, 10x Growth, 12 Employees, 410 TB

#71
post #45

Earlier quoted context omitted.

... and when we look at the um... "old" fart Java... their roster is even more impressive: LinkedIN, Google, NetFlix, Amazon. Just commenting ... :D

Regarding Google my understanding is that Java is only used in a few areas, and is far from the majority of their portfolio. Most their production systems are C++, while a lot of offline processing is Python. There is even a smattering of .NET (in Orkut). I think Java was used in Wave, but that is now defunct. Likely a few of these systems are being migrated to Go. Likewise with Amazon. My understanding, from chattin…

Transcript from Coders at Work interview with Joshua Block:

Seibel: As a Java guy at Google, do you think it could be used more? Leaving aside the force of history and historical choices, if somehow you could wave a magic wand and replace all of C++ with Java, could that work?

Bloch: Up to a point. Large parts of the system could be written that way, and over time, things are moving in that direction. But for the absolute core of the system - the inner loops of the index servers, for instance - very small gains in performance are worth an awful lot. When you have that many machines running the same piece of code, if you can make it even a few percent faster, then you've done something that has real benefits, financially and enviromentally. So there is some code that you want to write in assembly language, and what is C but glorified assembly language?

Re: Pinterest Architecture Update - 18M Visitors, 10x Growth, 12 Employees, 410 TB

#72

Earlier quoted context omitted.

Yes, but the Django ORM helped them launch faster. There is nothing wrong using it to start with and then writing your own SQL queries when you need to scale or even changing your data model to accommodate scaling.

I hate the Django ORM and I don't know why Django doesn't just deprecate it and switch to SQLAlchemy as the new default, which is a much, much better ORM and used primarily by non-Django Python apps.

Why don't YOU try?

Re: Pinterest Architecture Update - 18M Visitors, 10x Growth, 12 Employees, 410 TB

#73
post #68

Earlier quoted context omitted.

You can. I feel sorry to those who can't :)

Of course you can, anything is possible, including convincing yourself Spring is as productive as Rails or Django :) Nothing against Java, it's the best tool for the job on many occasions but launching quickly and scaling fast are not it's forté.

When was the last time you use Spring? How about Spring MVC for front-end/controller and or JAX-RS for web API.

I find Java to be much more modular and adaptable to different web paradigm: old school MVC, one page JS style (GWT or pure JS), asynchronous (Netty or Servlet 3.0), scalable web api that can spit both xml and json without extra coding (JAX-RS), component oriented (JSF).

The integration between business logic and let say if you somehow need to use message queue are quite good via EJB 3.1 (very minimum coding) and JMS.

Java took a beating a few years ago, fast forward to 2012, they have improved quite significantly. In the next two years, multi tenant architecture will be available in JavaEE 7 out of the box.

Many people who keep complaining about Java typically are those who have wayy past experience.

Re: Pinterest Architecture Update - 18M Visitors, 10x Growth, 12 Employees, 410 TB

#74
post #66

Earlier quoted context omitted.

... and when we look at the um... "old" fart Java... their roster is even more impressive: LinkedIN, Google, NetFlix, Amazon. Just commenting ... :D

> ... and when we look at the um... "old" fart Java... their roster is even more impressive: LinkedIN, Google, NetFlix, Amazon. Sure it is. But I won't use Java for web stuff. I might use it for some background services, but for regular CRUD functionality, Java buys me nothing. I generally use Python(Flask)/Jinja2/Flask-SqlAlchemy. Flask is intuitive; Jinja2 is pleasant and fast; Flask-SQLAlchemy is concise with the…

And the last time you use Java was....5 years ago?

Better keep up with the latest frameworks and libraries.

I know Rails and Django and I used cherrypy, cheetah, and sqlalchemy as well, and Java is on par with both modern frameworks if you know to choose the right frameworks.

In fact, I do not have to deploy multiple processes one for Rails and one for sinatra or node.js. Just some app server or web container and I am ready to go.

... And you are asking me to check out a "toy benchmark"?

I care more for the overall solutions from deployment, tools, etc. End to end baby...

Re: Pinterest Architecture Update - 18M Visitors, 10x Growth, 12 Employees, 410 TB

#75
post #66

Earlier quoted context omitted.

> ... and when we look at the um... "old" fart Java... their roster is even more impressive: LinkedIN, Google, NetFlix, Amazon. Sure it is. But I won't use Java for web stuff. I might use it for some background services, but for regular CRUD functionality, Java buys me nothing. I generally use Python(Flask)/Jinja2/Flask-SqlAlchemy. Flask is intuitive; Jinja2 is pleasant and fast; Flask-SQLAlchemy is concise with the…

And the last time you use Java was....5 years ago? Better keep up with the latest frameworks and libraries. I know Rails and Django and I used cherrypy, cheetah, and sqlalchemy as well, and Java is on par with both modern frameworks if you know to choose the right frameworks. In fact, I do not have to deploy multiple processes one for Rails and one for sinatra or node.js. Just some app server or web container and I a…

> And the last time you use Java was....5 years ago? > I know Rails and Django and I used cherrypy, cheetah, and sqlalchemy as well, and Java is on par with both modern frameworks if you know to choose the right frameworks.

What are these frameworks in Java you talk about which are as expressive as Django and Rails? Less verbose that it was before isn't the same as as expressive as Rails/Django.

> In fact, I do not have to deploy multiple processes one for Rails and one for sinatra or node.js. Just some app server or web container and I am ready to go.

Rails/Django deployment isn't that hard. If you are talking about a large app, deployment is a very small consideration compared to other aspects.

As far as multiple processes go, more often than not, large apps are run as collection of co-operating services. That is by choice, irrespective of whether it's implemented in Java or Python. Which one of the examples you listed you think runs as some app server and container?

> ... And you are asking me to check out a "toy benchmark"? > I care more for the overall solutions from deployment, tools, etc. End to end baby...

All benchmarks are toys. If you want "end to end", the only way is to do it is to implement the same app in Python and Java, and then compare them. Doing that would be batshit insane(sure, we are going to do too versions of pinterest to compare whether we write it in Java or Python), nobody does that, nobody should do that.

As far as benchmark goes, I only claimed that out of box code in Java performs like dogshit, and I am to jump hoops, I would rather jump hoops in Python, Ruby, Clojure et al.

Re: Pinterest Architecture Update - 18M Visitors, 10x Growth, 12 Employees, 410 TB

#76
post #75

Earlier quoted context omitted.

And the last time you use Java was....5 years ago? Better keep up with the latest frameworks and libraries. I know Rails and Django and I used cherrypy, cheetah, and sqlalchemy as well, and Java is on par with both modern frameworks if you know to choose the right frameworks. In fact, I do not have to deploy multiple processes one for Rails and one for sinatra or node.js. Just some app server or web container and I a…

> And the last time you use Java was....5 years ago? > I know Rails and Django and I used cherrypy, cheetah, and sqlalchemy as well, and Java is on par with both modern frameworks if you know to choose the right frameworks. What are these frameworks in Java you talk about which are as expressive as Django and Rails? Less verbose that it was before isn't the same as as expressive as Rails/Django. > In fact, I do not h…

Expressive lies in the language not in the framework, I think you have a different mindset on that one but I'm not sure what you're trying to achieve.

Spring MVC is on par with Rails VC (let's leave ActiveRecord for another time) or Django TV minus Django ORM.

Testing? Spring has a really good testing library that plays with both straight up Java EE components (Servlet, Portlet, etc). Functional, Integration, Unit-Test, name your game.

Migration? Flyway works nicely and I don't have to spend days to set it up, just less than an hour for multi-year project. Minuscule in terms of effort. It just works.

I'll give you that ActiveRecord is nicer than JPA 2 (but not by a lot). The rest are... indifferent, same stuff, same type, same ol' same ol'.

JAX-RS can spits both XML and JSON easily with no code changes. I don't have to use Sinatra (or node.js) for web-api and deploy it separately from Rails: just deploy JAX-RS project as a separate WAR to the AppServer and I'm done. Done.

I don't need to spin up a different process, write a script to do X,Y,Z, maintain another infrastructure, etc etc.

Regarding your mark about benchmark: then don't start flashing numbers and stuffs if they are toys. If OOB Java is like dog stuff then Python, Ruby are like snail or turtle.

Wait, what am I doing trolling like redditors or slashdotters over mindless debate.

sigh technology has never been the problem, the people are sigh always holds true.

Re: Pinterest Architecture Update - 18M Visitors, 10x Growth, 12 Employees, 410 TB

#77
post #68

Earlier quoted context omitted.

Of course you can, anything is possible, including convincing yourself Spring is as productive as Rails or Django :) Nothing against Java, it's the best tool for the job on many occasions but launching quickly and scaling fast are not it's forté.

When was the last time you use Spring? How about Spring MVC for front-end/controller and or JAX-RS for web API. I find Java to be much more modular and adaptable to different web paradigm: old school MVC, one page JS style (GWT or pure JS), asynchronous (Netty or Servlet 3.0), scalable web api that can spit both xml and json without extra coding (JAX-RS), component oriented (JSF). The integration between business log…

The company I work for (which would qualify as an enterprise by any standards) decided to switch over to Django almost 3 years ago, rewriting our existing Java infrastructure on a project-to-project basis. The reasoning was primarily two-fold, we'd begun to have trouble recruiting good new talent interested in working with Spring/Java and we felt that for what we were doing, Java was not the strongest technology choice anymore (not like it was 10 years ago).

Last year, we switched a 55k loc Spring MVC (with JAX-RS for the json api) over to Django (using tastypie for the api side and celery for offline tasks). The result ended up being little over 8k loc of Python. Closing a ticket has gone from taking on average around 5 days to a little over 4 hours. That was the third project we ported over, the others having had similar success. YMMV.

Re: Pinterest Architecture Update - 18M Visitors, 10x Growth, 12 Employees, 410 TB

#78

Earlier quoted context omitted.

Excuse me but couldn't they just optimize the way they use Django ORM? ... as in: check the output of SQL queries constructed by Django ORM and tweaked it in your Django Model layer such that the resulted SQL query will be tuned for performance? Or at the very least, shouldn't Django ORM at least provide a way to retrieve data with "filtering" as optional parameters? (get only a few columns, but not all..)

Let me tell you something If you're reading "just tables" without, or with simple relations and conditions, it's ok (because, as you pointed out, that's basically SELECT with) The problem is when for example you have inheritance, or moderately complex relations. Then you'll see Django spamming your DB with requests and the DB may be fast but the operation will be slow because of the sheer number of requests. So yeah,…

Inheritance is a different beast that ... well, let's just say that it may creates and endless debate whether one should or should not have inheritance in the model...

My experience is heavily in Java (JPA2 and Hibernate) and less of Rails (simple/moderate apps). Typically an ORM provides a way to handle custom queries but still help maps the result to the Java object model (which helps a lot vs writing getter/setter :)).

I don't know how people down south in Silicon Valley design their model (especially young scrappy startup) but I have a slightest doubt that they go that far (advanced/complex). It's not like startup start with "analyzing requirements" and move on to "modelling session" :) => they just go ahead and write code.

So in theory, the data model shouldn't be complex enough to warrant edge-case.

Re: Pinterest Architecture Update - 18M Visitors, 10x Growth, 12 Employees, 410 TB

#79

Does anyone else feel that 410TB of user data seems quite a lot? If I have my maths right, even if all the 80 million objects are user data (as opposed to, say, logs) thats 5.3mb per object. Considering that most pinterest photos are from the web, that seems quite big.

Original image plus two (or more) scaled thumbnails. Also, I don't think they're doing any reuse (upload the same pin for 2 different S3 objects of the same image). 5.3Mb / object is still really high though.

Wow, if they are not doing any reuse that really really dumb. I can't back this up, but would have thought at least 50% of all pins are repins.... if that 410TB figure is correct, this oversight is costing them $18k a month. It would be simple to have a separate asset id and pin id...

Re: Pinterest Architecture Update - 18M Visitors, 10x Growth, 12 Employees, 410 TB

#80
post #72

Earlier quoted context omitted.

I hate the Django ORM and I don't know why Django doesn't just deprecate it and switch to SQLAlchemy as the new default, which is a much, much better ORM and used primarily by non-Django Python apps.

Why don't YOU try?

Why don't I try what? Deprecating the Django ORM? I've already done so on a personal level (in fact, I avoid Django wherever possible), but since I don't control the Django project, I can't deprecate it for everyone, as I suggested in the parent comment. :)
Post reply on HN