Note: I know that none of you (probably) work for google, so this is a lot more of a conceptual question.

So yeah, i discovered that Gmail uses java and that got me thinking, Why?

I personally never really learned java and am familiar with C/C++, Python, Php e.t.c But what i dont understand is why do some websites use languages such as java? (Note: This is in no way a thread saying one language is better than the other). What i want to know is why do some websites such as Gmail use java and similar languages?What advantages/disadvantages come with using java/similar languages over languages such as php/python/ruby for web development?

Ps: I know that some sites prefer to compile their code for optimization(Like facebook's hiphop)

  • Actually I've noticed quite a few googlers on SO. Commented May 4, 2013 at 12:37
  • Sharing your research helps everyone. Tell us what you've tried and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer. Also see How to Ask
    – gnat
    Commented May 4, 2013 at 14:25
  • @jozefg Actually very many google searches in programming area leads to SO.
    – Random42
    Commented May 4, 2013 at 14:29
  • @m3th0dman Sorry I was unclear, Googlers as in people who work at google, that's what my friend refers to himself as. Commented May 4, 2013 at 16:03

1 Answer 1


Because Java has a pretty good trade-off between productivity and performance; it is somewhere between PHP/Python which are very productive and C/C++ which are very performant.

Gmail is a large site which has lots of clients; here problems of scalability occur and Java is a more scalable language than PHP or Python.

Also Java has some very good frameworks good for web, being the first language used for web programming even if now is used more rarely, only in large systems such as Gmail reigning only in the enterprise area.

Take Twitter as another example; it was initially written in Ruby but has been migrated to Java for scalability.

  • 2
    I think Perl was very popular for writing web applications before Java but (even though I am not a Perl expert) I can imagine Perl suffers similar scalability problems as other scripting languages.
    – Giorgio
    Commented May 4, 2013 at 12:24
  • @Giorgio Yes you are right; back then the web server was delegating requests to CGI scrips that delegated the work to executables; most of these scripts were written in Perl. Java was new because it allowed writing web servers that directly generated the response and handled the work and also allowed dynamic content in the browser with the Applets.
    – Random42
    Commented May 4, 2013 at 14:27
  • Well said. You can develop multi-threaded (1 process with multiple threads) apps with Java and you cannot with PHP. For server side development, this allows you to get more utilization out of the server so you need fewer servers to do the same amount of work that you could get when using PHP.
    – Glenn
    Commented May 4, 2013 at 19:14
  • 3
    Is this answer conjecture, or based on pubished or first hand knowledge?
    – mattnz
    Commented May 6, 2013 at 0:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.