I'm currently facing a dilema regarding the appropriate server-side framework to use.
Basically, I want to choose the best framework for building a large website to serve millions of page hits. The website itself will be heavily database and ajax reliant, and thus will need to be planned for scalability right from the start.
My wants/needs for a suitable server-side framework are the following:
- High-Level OO-based language support with some meta programming support.
- Proper scalability and load balancing on a framework level.
- MVC architecture.
- ORM support or atleast Object level mapping support.
- Proper routing (URL Rewriting) support.
My question finally is that is the Java Spring framework a suitable candidate for a operating a large website based on the wants and needs that were mentioned above? Should I stick to something like Django or Rails?
I would prefer the following.
Almost any framework, if used properly, will do. Spring / Spring MVC is a good choice:
Spring is a good framework. However, by itself it is not going to solve your scalability problems (and no other framework would).
To scale heavy load on servers you need to make sure that your servers are stateless or use load balancers with sticky sessions. To reduce load on database you will need caches. No framework will solve it for you.
In other words, think about overall system design rather than specific coding framework.
I would go for Spring.
Web Server: -Static Contents to be hosted by Web server: http://nginx.org/en/. -A lot of assets could be hosted in a Content delivery network. -Enabling gzip compression @ web server and application server. -The GUI should be thick client and only fetch data from the server once initialized. -Reduce the # of trips to server. -Compress the contents (HTML,CSS,JS,Embed images in the html itself etc.)
Application Server: -Ensure you using pooling techniques for all the resources that are involved like DB, message processors etc. -Good coding practices which are optimized for garbage collection. -Using NBIO application servers (JBoss Wildfly,Netty,Tomcat 8 etc.)
Database: -Clustering the DB. -Denormalizing the database and maintaing soft integrity in the code rather then in the DB. Referential integrity & constraint checks have a huge cost in querying (Join, insert,updates etc.) -You can look @ migrating to ACID NoSQL databases like Orient DB.
Another good choice - and a standards based one at that - would simply be Java EE. EE 6 is a good option, and JBoss AS 7 - which supports EE 6 - has made great headway, is small, efficient and lightning fast. And is free and open source.
Java EE 6, as a standard, has pretty much all you'd need: CDI as a programming model, web front-end based on JSF, JAX-RS for RESTful web services, JPA2 for object-relational mapping, and if you so need it, JMS messaging, etc etc. Sun/Oracle's Java EE 6 tutorial is probably the place to start if you want to learn about this tech.
And if you choose to go with JBoss as a runtime environment, you have great tooling as well - a set of Eclipse plugins to make building Java EE apps a snap.