Scalability Thumb Rules for Programmers (2011)

less than 1 minute read

  1. Avoid Synchronization. Keep it short.
  2. Use lock-free data structures and those in java.util.concurrent.atomic
  3. Use Non-Blocking I/O java.nio package for high-scalability. Use only for very high throughput applications.
  4. Single thread tasks ARE a problem and would not scale on multiple CPUs. Use parallel execution.
  5. More memory mean more GC freeze time.
  6. SQL DB becomes the bottleneck ultimately. Work around this constraint.
  7. Synchronous logging is a seriois issue. Must avoid.
  8. No single point of Failure.
  9. Failover mechanism - by load balancers and automatic watchdog/recover scripts.
  10. JVM Caches (internal to JVM) should be read only. Use clustered caches instead with replication.
  11. Replicate sessions in real time (on the cluster/DB etc.)
  12. Keep session objects Serializable. A good practice is to enforce the use of a custom method like the addObjectToSession(String key, Serializable value) method, instead of the default HttpSession.setAttribute (String key, Object value) method when adding session data.
  13. Have application level failsafe.
  14. Use distributed cache that is scalable. Memcache, Terracota and Jboss cache are good examples.
  15. Use NoSQl or Bigtable like distributed databases such as Cassandra, MongoDB, Hypertable, CouchDB or HBase (for Hadoop)

Leave a Comment