使用 WCF 端点通过 HTTP 传输 SQL 表格数据的最快方法是什么?
现在我正在使用 ESQL 查询实体框架,然后将 DataTable 结果序列化为一个字节 [],然后将其发送过来,然后在另一端反序列化,这似乎很慢。现在,15000 多行的序列化数据的大小约为 4000 字节。我还尝试了 OData 服务,但这也很慢。
与 JSON 相比,我认为它是最快的 - 一个仅包含 1048 个 SQL 行的 JSON 文件大约有 200000 个字节。数据大小与通过 HTTP 传输的速度之间是否存在直接关联?(似乎很直观,但我并不积极)。
最快的格式是什么?我正在考虑使用 SQLDataReader 到 JSON 并将 JSON 发送过来,我认为它应该表现良好,但我不确定。这仅用于数据同步目的。
谢谢。
编辑 做了一些更多的跟踪,看起来我的一些初始测量是错误的。请参阅下面的相应方法(以毫秒为单位)。
2011 年 7 月 11 日星期一下午 6:42:23: :函数“反序列化”持续时间。已用时间:481 毫秒
2011 年 7 月 11 日星期一下午 6:42:23 : : 函数“HttpRequest”持续时间。已用时间:4776 毫秒
2011 年 7 月 11 日星期一下午 6:42:22::DataTable 长度(字节)= 13047247 字节
上面引用的 DataTable 包含约 7000 行,看起来很陡峭,对吧?