Lesson learnt : Switching from Desktop Application to Web Application development | Akshay Deo Lesson learnt : Switching from Desktop Application to Web Application development · Akshay Deo

Lesson learnt : Switching from Desktop Application to Web Application development


Just to give an introduction, I work on core technology of AppSurfer. Part of which is done in Django. Before starting my own venture I was a part of a MNC where I used to work on desktop applications written in C#.net. So before starting my first major web application, I was never part of any web application. And hence I struggled a lot to decide architecture of my web application. I am going to discuss one aspect of web application here, Database transactions during request processing.

The problem
When we are developing a desktop application, what we mainly concentrate on is modularity of code. We take out entities, implement them and go on expanding the system depending upon responsibilities of every entity. We really dont care about (mostly as it will be running locally and now a days normal desktop is quite fast so that we can rely on optimisation made by compiler, databases and database connectors) number of db writes and pull, subroutine calls and number of indirections. Our main concern is to make system more lossely coupled, and modular.

What goes wrong
In the process of making my web application more modular and lossely coupled, I ended up making a lot of modules and a lot of persisting data which means more interaction with database. Now usually the business logic of your web application takes on an average say 10% (its based on statistics of my web application) and 90% of the time is for db queries roughly. So obviously less number of db queries, less response time hence faster execution, less load on server etc etc.

What we can do
One of the thing I did was, I removed unnecessary modules from my web application. And wrote most part of the apploication as a script. Secondly once an object is taken from db, perform all operations related to it and hence bring most of the operations related to it at a place and then store that back into the db. Use other db and UDP based logging system so as to make your application independent of logging and error catching. This small change brought a huge difference in db response and overall app response time.

Consider marked points, as snapshot is from production and other is from staging server.(Using new relic analytics)
Before my changes overall db response time
[2]
After my changes overall db response time
[3]

Hope you will find this post useful.
Thanks and keep coding :)


powered by TinyLetter



Comments