开发者

Should I rebuild my PHP website with a document database in order to improve performance?

开发者 https://www.devze.com 2023-01-20 05:50 出处:网络
We have a website developed in PHP with MySQL and sometimes facing problems when traffic increases. We have almost optimized the site in all ways to handle more requests but still facing problems at p

We have a website developed in PHP with MySQL and sometimes facing problems when traffic increases. We have almost optimized the site in all ways to handle more requests but still facing problems at peak hou开发者_运维百科rs.

One of my friends suggests to rebuild the site using HBase / MongoDB as back-end to improve the performance. Also he suggests that if we rebuild it, we can easily move to cloud services. But we need to learn entire thing and redevelop it.

Is it better idea to do so?


The first thing to do is to profile your web app to determine what the bottleneck is.

If it's definitely queries to the database, then replacing mysql with mongodb might be a good idea, but document databases work in a different way to relational ones, and you might have trouble porting some types of functionality. If you do decide to try mongo, prototype early and often, because there's no garuantee it will be faster for you.

If scalability really is a problem for you, then why not jump straight into a cloud-based web architecture like google app engine. This is java or python and document database (bigtable) based, but forces you into a scalable "cloud" architecture from the very beginning.

Another option is to simply introduce (or optimise) caching (with memcache) - this will have less architectural effect on your application therefore take less effort.


There are simple MySql scalability options out there too. Back in the "dark days", we'd just throw dedicated hardware at the DB as step one, more recently, clustering became possible. There's also cloud-type solutions that are MySQL based you could use. For instance, Amazon's RDS claims to work with all the same commands as MySQL and also claims to be an easy conversion.

Before you get down to all that, I'd recommend optimizing, indexing, and profiling. I've run PHP/MySQL CMS-based sites with 1 million+ uniques a day with no need to go to the cloud. The code is the key.

0

精彩评论

暂无评论...
验证码 换一张
取 消