最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

php - sending large JSON data from server - should I compress? - Stack Overflow

matteradmin2PV0评论

I am sending large datasets in JSON format from my server (using PHP). I want to keep bandwidth costs down. I am wondering:

  1. should I gzip press the JSON data server side before sending the data?
  2. is there a javascript gzip unpression library?

I am sending large datasets in JSON format from my server (using PHP). I want to keep bandwidth costs down. I am wondering:

  1. should I gzip press the JSON data server side before sending the data?
  2. is there a javascript gzip unpression library?
Share Improve this question asked Nov 22, 2010 at 11:20 skyeagleskyeagle 3,27111 gold badges41 silver badges41 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 5

Yes, you should press your output (but only for transmission). But you can let your sever do it for you. If you use a standard pression on HTTP level the client will depress that automatically.

Yes, you should gzip press it — but at the web server level, not the application level. Then neither your server- nor client-side code needs to worry about it, it happens as part of the HTTP transfer. In Apache, for instance, you configure this via mod_deflate. In nginx, you use the Gzip module. Any half-decent web server will allow you to press content on-the-fly (including dynamic content).

If you send this data to a grid you could reduce the sent data by paging the grid. This way only a certain number of rows is sent to the grid and the rest of the data will be sent on request.

Post a comment

comment list (0)

  1. No comments so far