Forum Moderators: phranque
I m finding the server side language for my website before building it. I need my site has a good speed like Facebook (Partial with PHP) cause it seems to be a social networking.
A few days ago, I have found C++ Server pages on [snip]. According to the introdution of that site, we can build a website by C++. And I have a test with Fibonaccy function. On C++ it faster 80 - 100 times than PHP. But I really worry about its security.
So I think I will develop my site base on C++ Server Pages. Before I have a final decission I need your advices so much.
1: which language server side is the best for hight performance?
2: What do you think about the C++ Server pages of [snip].
3: Do you have any advices?
Thanks for reading and replying
[edited by: phranque at 9:56 pm (utc) on Oct. 9, 2009]
[edit reason] No urls, please. See TOS [webmasterworld.com] [/edit]
Compiled applications will generally run faster than purely interpreted ones, but with caching schemes of various sorts you can eliminate much of the difference. Your example comparing C++ and PHP is unreliable, because with opcode and memory caches active, PHP can be made to run far faster than with a base configuration.
Also, bear in mind, that if you choose a compiled language and later decide to change host, your choice will be limited since few allow compiled languages to be used (but I don't understand why).
Kaled.
I think, If the code in *.csp (Sever Side extension - C++ & HTML) was definitely builed by pure C++ so the distance (compile, interpreter... whatever) from *.csp code to machine code is shorter than *.php (or another high language).
Just that...
Thanks for following
I need my site has a good speed like Facebook (Partial with PHP) cause it seems to be a social networking.
On a social networking site the performance impact of the database manipulations is more important than the performance impact of the code which generates the HTML pages.
The trick is to have a good scalable database design which doesn't slow down with an increasing number of concurrent connections and queries.
Caching strategies will only ever be effective if pages change infrequently.
What is your definition of infrequent? We utilize memcached on our most popular pages. We have programmed logic to update each page in the cache when it is updated, which can be as often as every few minutes.
Now if you are talking about a page that updates every few seconds, that can make caching the entire page difficult, but it does not stop you from caching pieces of the page makeup.
Facebook, YouTube, etc all use caching solutions and they are all updated frequently.
If pages are required to change per user and/or per reload, caching will never work.
Again, you need to be creative. You can cache bits and pieces of a highly dynamic page to take the pressure off the database. You can even cache query results, headers, footers, anything you want. Perhaps you have a complex query that calculates the user's rank among other members. That might be something you display on every page, but does not necessarily need to be "live". Cache it and save yourself tons of processing per page. Maybe update that cache every 5 minutes, or whatever works for you.
The point is, you need to look at caching as a solution beyond just the old school page caching. I've yet to see a page on the internet that could not benefit from some sort of caching.