与简单文件请求相比,您期望Web服务请求有哪些响应时间开销? [英] What response time overhead would you expect for a webservice request compared to a simple file request?

查看:56
本文介绍了与简单文件请求相比,您期望Web服务请求有哪些响应时间开销?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个asp.net网络服务应用程序,以向使用jQuery.ajax发出请求的小部件提供json格式的数据.我一直在使用FireBug Net视图检查数据请求需要多长时间.

在我最初的原型中,我只是请求静态json数据文件,显然在IIS上,它在我的开发机上很快地返回了它-大约2到5毫秒,即使浏览器的缓存中不存在.

现在,我已连接到Web服务,但我担心数据请求太慢,因为它们始终需要200毫秒左右的时间才能返回.(这甚至在第一个请求过分编译内容并花费大约6整秒的时间之后.)我已经从Web请求中删除了所有数据库/处理开销,因此应该花费很少的时间来处理,并且这仍然在进行中本地开发人员计算机,因此没有网络延迟.使用发布版本和在生产服务器上的开销再好不过了.

我的问题是这样:

这个200ms左右的响应时间是否是我希望从仅返回"Hello World"的.net Web服务中获得的最佳响应时间?如果有可能做得更好,那么我到底在做错什么呢?如果不可能的话,您会怎么做?

解决方案

如果在连接数据库等方面实际上什么也没做,那么您应该能够获得200毫秒更好的响应时间.

如果您是在服务器而不是客户端来测量时间,您会看到什么?您是否尝试过使用WireShark来查看网络中发生了什么?

基本上,您希望能够尽可能准确地创建一个时间轴,以显示客户端何时发送请求,何时请求到达服务器,何时服务器端代码接收到请求,何时服务器端代码完成处理请求,服务器实际发送响应的时间以及客户端实际接收响应的时间.

到那时,您可以找出瓶颈所在.

I'm developing an asp.net webservice application to provide json-formatted data to a widget that uses jQuery.ajax to make the request. I've been using the FireBug Net view to check how long the requests for data take.

In my initial prototype I was simply requesting static json data files, which on my dev machine were obviously returned very quickly by IIS - in around 2 to 5ms, even if not present in the browser's cache.

Now I've connected to the webservice I'm concerned that the data requests are way too slow, as they are taking consistently around 200ms to return. (This is even after the first request which is obviosuly compiling stuff and taking around 6 whole seconds.) I have removed all database/processing overhead from the web request, so it should take very little time to process, and this is also still on the local dev machine, so no network latency. The overhead is no better with a release build and on a production server.

My question is this:

Is this response time of around 200ms the best I can expect from a .net web service that is simply returning 'Hello World'? If it is possible to do much better, then what on earth might I be doing wrong? If it isn't possible, what would you do instead?

解决方案

If it's really doing nothing in terms of connecting to a database etc, then you should be able to get a much better response time that 200ms.

If you measure the time at the server side instead of the client side, what do you see? Have you tried using WireShark to see what's happening in the network?

Basically you want to be able to create a timeline as accurately as possible, showing when the client sent the request, when the request hit the server, when your server-side code received the request, when your server-side code finished processing the request, when the server actually sent the response, and when the client actually received the response.

At that point you can work out where the bottleneck is.

这篇关于与简单文件请求相比,您期望Web服务请求有哪些响应时间开销?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆