MEAN Stack vs LAMP Stack

Once you have your product idea ready, one of the most important questions that you face is: What technology stack should I use for my product?

Choosing the right technology stack for your product is very important and equally difficult in this age when you see people advocating the benefits of different technologies over others. This dilemma can be eased a lot if you have some basic insights and true information on the matter. In most of the cases, contradiction is between some mature technology stack and a young newcomer with a lot of promises and buzzwords everyone is talking about. In this discussion we are comparing a long term leader LAMP Stack and a highly promising and modern MEAN stack but a lot of this applies to others as well. Understanding this can help you make an informed decision choosing the technology stack for your next good product.

Here we are discussing about web applications. So, first we must understand how web applications work and what are the major stakeholders (in tech context). In general, a web application can be divided into 4 parts. The first two of these points apply to the Backend and API development as well.

  1. Server Side Scripting: for application logic programming
  2. Database Management: to store and retrieve the data using server side programming
  3. Presentation/UI: Display the data to the users
  4. Client side programming: to make is more interactive

LAMP stack stands for Linux Apache MySQL and php/pearl/python. On the other side MEAN means MongoDB, Express.js, Angular and Node.js. Let’s discuss all of these 4 parts of a web application one by one with respect to LAMP stack and MEAN stack.

Server Side Scripting

The server scripting part of LAMP vs MEAN are php/pearl/python vs node.js. Here we’ll discuss php vs node.js for easier understanding.

PHP is an open source server side scripting language designed specifically for web application development in 1994. It has got a lot of love from developers and businesses alike for a long duration. According to different surveys around 80% of websites are developed with php. Through its initial phase, php had some bad reputation about security which was more because of bad programming practices followed by some programmers than because of its own features. But later on it has improved a lot and gained a good reputation among the community. Because of very vast usage and so long period of dominating the web development domain, php has a lot of libraries, frameworks, packages, resources and a huge community for help.

Node.js was initially released in 2009. Node.js is an open source server side runtime javascript environment built on Chrome’s javascript engine V8. Since its birth, node js received a warm welcome from developers being javascript language which almost every web developer is familiar with. One great appreciation node js received since starting is its faster performance compared to php thanks for being asynchronous in nature. In 2015, php7 was introduced. Thanks to PHPNG engine used in php7, performance of php was increased upto 2 times and memory consumption improved upto 50%. And after that differences in performance of php is no longer a significant issue when compared to node js.

Being asynchronous in nature and non-blocking I/O model, node js is ideal for applications where you need real time communication between browser and server. The example use cases might be chat rooms, stock trading, live streaming etc.

Hence it is clear that both php and node.js have their own advantages and it depends on your application which technology is better suited for your application/product. When is doubt your developer may better understand which technology is better fit for your requirements.

Want to Know the Best Suited Techonology Stack for Your Backend?

Discuss with Our Experts

Database Management

In LAMP stack mySQL (or mariadb, postgre-sql etc) is used for database management while the counterpart in MEAN stack is MongoDB. MySQL is a Relational Database Management System while MogoDB is a noSQL. Both are completely different by nature and have their own pros and cons. MongoDB (or NoSQL databases in general) store the data in json like documents that can vary in structure while MySQL stores the data in tables with defined structure. Though, later versions of mysql support JSON data type where json documents can be stored but if your entire database is unstructured, NoSQL databases would be a preferred choice. Another famous advantage of MogoDB is its capability to handle huge data with horizontal scaling which normally influences a lot of decisions. But you should mind the amount of data which mysql can easily handle. We at techosquare solutions have developed and are maintaining some of the applications with upto 5GB of database with aws t2.small instances (having only 2GB of RAM) and it never lags or cause any problems even generating very complex reports. And that is not the limit. Several developers claim to be using upto 10TB of databases with mysql easily. So, don’t be impressed with the claims (though true) that mongodb can handle comparatively larger databases. More important is what type of data will your application have and what operations on that data will it be performing. There are several cases where developers chose mongodb for the sake of faster operations on huge data but later on regretted when they found it more difficult to do complex transactions and faced data integrity issues.

So, if you have a good size database being managed with RDBMS like mySQL and it lags in performance, don't rush to shift to noSQL based databases. Get in touch with some expert database managers and check the reason.

An experienced and mature developer can suggest you better which database management system is better suited for your application based on your application needs.

Not sure if your project should use mySQL or MongoDB?

Discuss with Our Experts

Presentation/UI

This part is done with html and css which is common with both LAMP and MEAN stacks being discussed here. In case of backend development as APIs or Microservices, the output is normally formatted as JSON or XML. So, there is not much to discuss on this topic.

Client Side Programming

Javascript is the language to be used for client side programming. MEAN stack uses Angular which is a javascript framework to reduce the efforts of the developer and create more interactive applications easily. On the other side LAMP means all the server side stack and allows Angular or any other javascript frameworks like react, vue etc to be used on client side. So, here again none of the frameworks make any difference.

Context Switching for the Developer

While developing a web application, the development team deals with different languages and contexts i.e. server side scripting, Database query language, html and client side scripting. In case of LAMP stack it translates to PHP, SQL, html and javascript. On the other hand with MEAN stack it becomes Javascript, Javascript (almost), html and javascript. Which is a good reason to go towards MEAN stack. But it depends on the development team, their working style and the libraries/resources they have developed over time. For example, we at TechoSquare Solutions have developed a library where we deal only with php which itself generates SQL and general purpose javascript wherever needed. For purely client side programming, in a mature team structure, server side and client side development is done separately (by different or maybe same developer) and hence there is not much context switching. But still advantage of mean using the same programming language on server as well as client side cannot be ignored.

More Aspects

There are more aspects to be considered while picking the technology stack for your product/application. For example availability of hosting services, availability of developers etc. PHP being a leader in web domain for so long, you get hosting and developers very easily for LAMP stack as compared to MEAN stack.

Conclusion

Both, LAMP stack and MEAN stack have their own advantages and which one you should choose for your application depends on the requirements. So consult with a good experienced development company to make the right decision.

Still not sure between LAMP and MEAN Stack?

Discuss with Our Experts