views:

122

answers:

2

I have an application which obtains data in JSON format from one of our other servers. The problem I am facing is, there is is significant delay when when requesting for this information. Since a lot of data is passed (approx 1000 records per request where each record is pretty huge) is there a way that compression would help reducing the speed. If so which compression scheme would you recommend.

I read on another thread that they pattern of data also matters a lot on they type of compression that needs to be used. The pattern of data is consistent and resembles the following

 :desc=>some_description
 :url=>some_url
 :content=>some_content
 :score=>some_score
 :more_attributes=>more_data

Can someone recommend a solution to how I could reduce this delay. They delay is approx 6-8 seconds. I'm using Ruby on Rails to develop this application and the server providing the data uses Python for the most part.

+2  A: 

gzip might significantly reduce the size of text data and optimize load speeds. It's also recommended by YSlow.

Darin Dimitrov
+2  A: 

I would first look at how much of this 8s delay is related to:

  1. Server side processing (how much took for the data to be generated) There are a lot of techniques to improve this time, including:

    • DB indexes

    • caching

    • a faster to_json library

Some excellent resources are the NewRelic podcasts on Rails scalability http://railslab.newrelic.com/2009/02/09/episode-7-fragment-caching

  1. Transmission delay(how much time took for the data to be sent between the server and the client)

Vlad Zloteanu