Genadinik
Genadinik

Reputation: 18649

Front and back end techniques to increase performance

What are some of the common and notable performance issues/bottlenecks that are typically encountered in a web application in both, the front-end layer, and the back-end layer?

An example of what I mean in a database is not having something you are querying on be an index. That would slow down the query. On the front-end it might be something funky going on with JavaScript that makes your application seem slow.

What are the general rules of thumb that help navigate such issues? And what are some good to-do's?

Thanks, Alex

Upvotes: 1

Views: 516

Answers (5)

Jack Liu Shurui
Jack Liu Shurui

Reputation: 580

convert dynamic contents to static contents. regenerate those static contents if their dependent objects changed. I saw one article said that more than 80 percent contents are static on Amazon website.

Upvotes: 1

Roy Dictus
Roy Dictus

Reputation: 33139

Use a CQRS-based architecture. CQRS stands for Command/Query Responsability Segregation; it basically means that you have different code (services) for reading from the DB and writing to the DB. A good practice for scalability is to have separate DB's for reading and writing (it actually does make sense, if you read more about CQRS), and you can scale out the reading database by having copies run on multiple servers.

CQRS is not only interesting from a scalability point of view, but also from a code maintenance and clarity point of view. It does take some effort to learn about CQRS and understand it, though.

Check out these links:

http://www.slideshare.net/skillsmatter/ddd-exchange-2010-udi-dahan-on-architectural-innovation-cqrs

http://www.slideshare.net/pjvdsande/rethink-your-architecture-with-cqrs

Upvotes: 2

datamunger
datamunger

Reputation: 81

On front-end:

-push all of your assets - css files, images, static content - to a CDN. Edgecast is pretty good and reasonably priced.

-don't use load entire javascript frameworks when you only need a few features from it. only load what's needed.

On back-end

-memcache the results from all database calls by using a hash of the sql query as the key name, and the result set as the value

-make sure you are not making your database tables really 'wide' - tons of columns and column types like 'text' and 'blob'

Upvotes: 3

Adrian K
Adrian K

Reputation: 10225

Millhouse is on to it. I can also add:

  • Batch expensive operations up. For example: don't make lots of individual calls to a database if you can do it all in one hit.
  • Avoid server hops where you can.
  • Process in parallel if you can (not so common for your 'average' web app but quite possible in larger Enterprise scale apps).
  • Pre-process: crunching data, pre-puiblishing content etc, the more you can do before it's needed the better.

Upvotes: 2

millhouse
millhouse

Reputation: 10007

For the front-end, there are well-known guidelines/rules you can follow, and there are some great tools like YSlow that can help you pinpoint the bottlenecks.

For the back-end, as you've noted, efficient use of indexes is a must. Other optimizations usually involve caching, and basic stuff like avoiding doing stuff within loops that can be done once. I'm sure people here will have suggestions, but remember "premature optimization is the root of all evil!" :-)

Upvotes: 3

Related Questions