Friendster addresses performance problems by switching from Java to PHP. Note in the comments how language zealots are flailing about pointing to benchmarks saying how much faster JSP is. The comments from the PHP guys are the only decent ones in the thread. I stand by the assertion that PHP is the top web language to use to get stuff done.
PHP rocks! I don’t think Friendster would just switch to PHP on a whim unless they really studied (and found out) that PHP provides them a better long-term solution.
PHP is great. I started on dynamic pages with ASP. I learned quite fast that ASP is a rip off of PHP. I now know PHP as good as HTML (okay, almost!). Still crap on MySQL, though.
I think that is a rather silly thing to say. PHP has its weaknesses just like every language. Just because Java isn’t the tool for the job in this case doesn’t mean there are many other cases where Java will outperform PHP in many aspects. And, as far as speed goes, differing technologies account for such a small portion of the variance that it’s barely worth discussing. For example, if you and I were to solve a given problem in PHP, your solution would undoubtedly be faster than mine, because I have only a syntactic-level understanding of PHP, while yours is much deeper.
It is not as much an understanding of PHP in particular but general programming skill that influences how good an individual’s code is. I admit, I’ve been throughly brain-washed by the professors of the CS department where I studied (and have teached). A good programmer is not only good with a given set of programming languages but can create good code with any programming language that uses a similar paradigm.
It is when we start getting into the peculiarities of each specific languages that significant performance improvement can be obtained compared to some other language, but in most cases a clean algorithm will produce better results consistently across languages than a messy implementation with language specific features thrown in. And if you consider the maintainability of the code, the situation is even different. Learn to think of your code in abstract terms first, i.e. design and then write. That is the best way to get code with adequate performance. And now the assistant in me goes back on leave and lets everyone get on with their hacking…
I found a couple of pages that discussed the architecture used for friendster. They had about 50 servers, each loaded with tomcat and mysql. They had a custom solution for replicating the data between the various servers. Each server contained the same set of data. So imagine, at some point, every request to the database, will be multiplied 50 times or so depending on how they did it.
This is such a poor way to implement the site. Had they seperated their database and application servers and rightsized the servers for each task, performance should have been a lot better.
Based on the various things I’ve read about the original implementation, it doesn’t sound like the people who wrote the site knew how to write a scalable j2ee application, regardless of the number of books they had written on jsp.
to get back to the java vs php flame war:
do php have all the “threads problem” that java servlets have?
if u don’t synchronize risk corruption of shared variables, threadlocal is complicated.
if u synchronize, welcome to the world of complicated chain of locks