Database Optimization

Hi guys,

I was wondering how I can actually optimize my code.

I’m trying to write a chat application and I had wanted my messages
saved into my database.

Imagine a browser with a chat window, you type in your message, click
the send button, render the message on the chat window on the same
browser then save into the database.

Initially, without any databasing, javascript write will take just about
1 sec. With databasing included, it takes 4-5 secs before the text gets
rendered into the div (I was counting one thousand one, one thousand
two, one thousand three… )

Code for saving into the database is really straight forward, nothing
fancy in the def.

Was wondering if you could help me out how to make this much faster.

Thanks,

Bing

Guest wrote:

Thanks,

Bing

It is hard to give any specific optimization advice without being able
to see your controller and view. In any case I would bet that you are
running in development mode? Try deploying with your environment set to
production and see if it still takes that long. If it does then show us
your controller and we will see if you are doing something particularly
slow. A simple insert and view update shouldn’t take much time at all.

Matthew M.
blog.mattmargolis.net