非常大的HTTP请求与许多小请求

编程入门 行业动态 更新时间:2024-10-17 09:51:28
本文介绍了非常大的HTTP请求与许多小请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

可能的重复: 非常大的HTTP请求与许多小请求

我需要一个2D数组(如Json)从服务器发送到客户端。它将是大约400X400大小,每个条目大约4个字符的文本。

I need a 2D array(as Json) to be sent from server to client. It would be around 400X400 in size with each entry around 4 characters of text. So that makes it around 640KB of data.

以下哪种极端方法更好?

Which of the following extreme approaches is better ?

$ b
  • 我发出400个请求 - 每个请求一行(约1.6 KB)
  • I make a large HTTP request of all the data at one go.
  • I make 400 requests - each asking for a single row (around 1.6 KB)
  • 我相信最佳方法会在中间。有谁能给我一个想法什么可能是这个数据的最佳单个请求大小。

    I believe optimal approach would be somewhere in middle. Could anyone give me an idea what might be the optimal single request size for this data.

    感谢,

    推荐答案

    提出要求时,处理一些开销(如DNS请求,打开连接并关闭它)。

    When making a request you always have to deal with some overhead (like DNS request, opening connection and closing it). So it might be wiser to have 1 big request.

    当你有一个大的请求时,你可能会遇到更好的gzip / deflate压缩。

    Also you might experience better gzip/deflate compression when having 1 big request.

    更多推荐

    非常大的HTTP请求与许多小请求

    本文发布于:2023-11-12 20:03:37,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1582407.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:非常大   HTTP

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!