For high scalability & performance needs for a social portal, is it advisable to have C++ or Java implementation at the backend of an PHP application ?
What are the benefits & trade-offs of the same ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In raw performance terms, C++ will get you a fair bit further than Java or PHP, and slightly further than C#. By this I mean that if you implement the same algorithm in these different languages you are most likely to see the best performance from C++ (although it will depend exactly on what you’re doing and how you do it – a different language on its own is not a magic bullet; you need to learn how to make the best use of that language, which can take years).
As @spender has said, using well thought out algorithms and architecture will usually give a greater gain in performance and a much greater gain in scalability than simply switching to a different language might achieve. Performance is fundamentally about being efficient (minimising your usage of resources like bandwidth, memory, disk and CPU) and scalabilty is primarily about making things work well in parallel (minimising contention for resources like data, bandwidth, memory and CPU, and minimising the need for different parts of your system to communicate with each other)
As @Kugel said, if you have a truly scalable architecture then you can to some extent just throw more hardware at the problem, which might initially be a cheaper approach than rewriting everything in a different language. However, if your site is successful, making your code as efficient as possible will reduce your hardware and running costs.
Another consideration may be development/maintainability related – if you are an expert in PHP and a newbie at C++, you may well squeeze more out of PHP than you can out of C++. You have to consider the whole picture and work out what is the most “commercially viable” solution, not just what is the theoretically highest performing one. Or you may find that your “thrown together and works surprisingly well” PHP solution is up and running in a week while your highly optimised C++ never quite gets finished.