Oh wordpress, how I have come to loath you. I have worked with many clients over the years who continue to want solutions built on Wordpress. At first this was not a bad idea, and made perfect sense, kind of like Microsoft Sharepoint made sense, ok, I take it back, Sharepoint never made any sense. The basic idea was to take software, built for blogging and build a blog. Wordpress excelled at this particular role. As time progressed and popularity grew for the Wordpress platform, so did its (bastardized) adaptations to many other roles which include ecommerce system, content management solution, and yes, I have seen it...inventory tracking system. And before you question my bold assumptions, please consider yourself informed that I have many years experience working in application development, systems and databases. Enough that I would say I have a pretty good handle on Wordpress.
So why do I loath Wordpress. I mean it is so popular and everyone is doing it. Well Wordpress has become a trendy thing kind of like those pet rocks...if anyone remembers those. Written in PHP (more on that in another post), Wordpress is easily customizable and it has a rather clever system for incorporating modules through the infamous LOOP which allows you to modify posts in nefarious ways. Coupled with a great templating system allows you to display your content in so many unique ways. So if everything looks so good, why do I loath Wordpress.
First of all, you ever try to scale Wordpress? Classic example of, "Oh my, our site has just gone viral we need to scale up. Let's talk to our developer and see what he can do." Developer responds, "you want to do what?" So many times I have been asked to make Wordpress scale. There are many problems with scaling Wordpress. First of all uploads are stored on the local file system. When you attempt to scale your Wordpress deployment horizontally, meaning adding more servers behind a load balancer, your deployments are not idempotent, as content changes, uploads are not kept in synchronization. There are modules that you can include to use cloud based storage solutions such as Amazon S3 and maybe can leverage Amazon CloudFront which may help at the cost of more code bloat.
Second, the database rapidly becomes a bottleneck. Especially if your content is changing rapidly. Relational databases such as MySQL (InnoDB) impose guarantees on data consistency, which is great, if you are running a bank. But in today's rapidly changing content environments, like Facebook, these platforms have had to adopt a different kind of model to ensure performance is maintained by moving to an eventual consistency strategy that allows databases to also scale horizontally, like Apache Cassandra. MySQL can support replication and there are various solutions for clustering MySQL, but multi-master replication requires a lot of bolt-ons. What you end up doing is using bigger, higher priced servers.
Also, PHP, our dear old friend. Still one of the most widely popular programming languages in existence, and by pure accident. Starting out as a page centric language has now adopted many of the Object Oriented goodness of other languages. So what is so bad about PHP. First of all, it is a run time compiled language so there is a lot of overhead per request. And let's not even go into the fact that PHP is not threaded so if you use Apache with mod_php, better get a lot of RAM. The forking model in Linux basically clones the parent process and if each process consumes 128MB of RAM, guess what, your forked processes to handle additional requests will also need 128MB of RAM. Using PHP-FPM is highly recommended if you have control over your execution environment, but my guess is that 90% of the folks using Wordpress just wanted a website to start with and their BlueHost/CPanel environment still uses mod_php and Apache.
Lastly, Wordpress is a rather large, monolithic application that fits into the world of containerized applications like a square peg fits into a round hole. Sure it will fit, just get a bigger hammer...Containers are nothing new, but their respective adoption in recent years has been staggering mainly because it makes it easier to deploy your applications into the cloud, which as a developer and a business gives you more time to focus on building out solutions, and less time managing servers. If you have ever read https://12factor.net/ the challenges of using Wordpress with any container management platform is a bit daunting. Wordpress was never really built containers in mind.
To conclude, Wordpress continues to evolve, but today I believe there are better alternatives available that fit into the new world of container based hosting environments which can both scale and provide a more robust user experience. I started into Micro-Web services about a year ago when I ditched Drupal to build out this site and I have never looked back. I based most of this site on micro-blogs built using Python Flask, but the architecture I used is clean, API driven with easily interchangeable parts. I liberated myself from the constraints of canned solutions and I encourage anyone looking for something better, to do so. I have posted my code out on my github account if you are interested in seeing how I implemented this particular solution.