- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
对于帖子的长度,我深表歉意,但有很多事情可能会导致我的情况,我已尝试将我根据其他帖子所做的所有设置更改包括在内。简而言之,我的 WCF 服务似乎一次被限制为 3 或 4 个并发客户端请求。如果我将应用程序池 Maximum Worker Processes 设置得更高(大约 10 个)或将服务行为 ConcurrencyMode 设置为 Multiple,我会获得更好的吞吐量(快几倍)。然而,这些似乎是解决实际问题的方法,带来了他们自己的问题。我错了,还是 IIS 应该能够在一个工作进程中启动我的 WCF 服务的许多实例(数十个或更多)来处理负载?我只知道我在某处缺少一个设置,但我找不到它。
编辑:到目前为止,在尝试这些建议时,我意识到我的数学与吞吐量有关。使用 ForEach 循环,我可以在 20 秒的时间内在服务器上获得估计的并发处理(每个任务持续时间 * 任务数/总运行时间)。对于正在完成的实际工作( sleep 10 秒),这似乎仍然很低,但不再低得离谱。
第二次编辑:我将@Pablo 的评论标记为答案,因为他的答案加上他的链接为我提供了显着提高性能的信息(我认为是 3 倍)。但是,我想提出后续问题-在 WCF/IIS 中处理并发请求的合理期望是什么?假设 CPU、内存和 IO 不是瓶颈,处理请求的实际限制/期望(每个 CPU)是多少?我正在寻找的是一个经验法则,它告诉我,如果不添加 CPU(或工作进程),我可能不会获得任何更大的提升。再次感谢。
(在 Windows 2008 Server 上,由 IIS 托管,1 个处理器)
WCF 服务配置(缩写):
<?xml version="1.0"?>
<configuration>
<configSections>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<services>
<service name="FMHIRWCFSvc.IRService" behaviorConfiguration="IRServiceBehavior">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="Binding1" contract="FMHIRWCFSvc.IIRService" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="Binding1" maxReceivedMessageSize="104857600">
<readerQuotas maxArrayLength="104857600"/>
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="IRServiceBehavior">
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceThrottling
maxConcurrentCalls = "500"
maxConcurrentSessions = "500"
maxConcurrentInstances = "500"
/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<applicationSettings>
<FMHIRWCFSvc.Properties.Settings>
<setting name="FMHIRWCFSvc_ir_dev_websvc_IRWebService40" serializeAs="String">
<value>http://ir-dev-websvc/imageright.webservice/IRWebService40.asmx</value>
</setting>
</FMHIRWCFSvc.Properties.Settings>
</applicationSettings>
<system.net>
<connectionManagement>
<add address="*" maxconnection="500"/>
</connectionManagement>
</system.net>
</configuration>
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IIRService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://{myserveraddress}/FMHIRWCFSvc/IRService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IIRService"
contract="wcf_local.IIRService" name="BasicHttpBinding_IIRService" />
</client>
</system.serviceModel>
<system.net>
<connectionManagement>
<add address="*" maxconnection="500"/>
</connectionManagement>
</system.net>
</configuration>
static void WCFTesting()
{
ConcurrentQueue<Exception> exceptionList = new ConcurrentQueue<Exception>();
int[] taskList = new int[250];
Parallel.ForEach(taskList, theTask =>
{
try
{
// Create the WCF client
BasicHttpBinding binding = new BasicHttpBinding {
Security = { Mode = BasicHttpSecurityMode.Transport },
SendTimeout = TimeSpan.FromSeconds(20)
};
EndpointAddress endpointAddress = new EndpointAddress("https://{myserveraddress}/FMHIRWCFSvc/IRService.svc");
IRServiceClient wcfClient = new IRServiceClient(binding, endpointAddress);
// Call wcf service method that sleeps 10 seconds and returns
wcfClient.TestCall();
}
catch (Exception exception) {
// Store off exceptions for later processing
exceptionList.Enqueue(exception);
}
});
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
...
public string TestCall()
{
Thread.Sleep(10000);
return null;
}
最佳答案
您使用的测试机制可能并不完全正确。
使用 Parallel.For()
并不意味着它将并行创建 250 个工作人员。在这种情况下,您似乎将基准测试限制在最适合您的客户端处理器配置的范围内,而不是实际测试服务器可以处理的内容。
如果您真的想调用 250 个并行线程并查看它的 react ,您可以手动创建所有线程。如:
var exceptionList = new ConcurrentQueue<Exception>();
const int max = 250;
int numberOfTasks = max;
var signal = new ManualResetEvent(false);
for (var i = 0; i < max; i++)
{
var thread = new Thread(() =>
{
try
{
// Create the WCF client
BasicHttpBinding binding = new BasicHttpBinding
{
Security = { Mode = BasicHttpSecurityMode.Transport },
SendTimeout = TimeSpan.FromSeconds(20)
};
EndpointAddress endpointAddress = new EndpointAddress("https://{myserveraddress}/FMHIRWCFSvc/IRService.svc");
IRServiceClient wcfClient = new IRServiceClient(binding, endpointAddress);
// Call wcf service method that sleeps 10 seconds and returns
wcfClient.TestCall();
}
catch (Exception exception)
{
// Store off exceptions for later processing
exceptionList.Enqueue(exception);
}
if (Interlocked.Decrement(ref numberOfTasks) == 0) signal.Set();
});
thread.Start();
}
signal.WaitOne();
关于WCF 吞吐量低于预期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11456076/
我有 5 个对象,a、b、c。d 和 e。 5个对象的hashcode如下: a => 72444 b => 110327396 c => 107151 d => 2017793190 e => 68
我目前正在为我当前的元素创建媒体查询,我目前面临的问题是某些东西导致我的导航栏在宽度低于 600 像素时无法响应。所发生的情况如附图所示。 这个问题其实我在之前的元素中曾经解决过一次,但是我对比了代码
我正在为网页编写媒体查询,并设法为 768 及以下版本编写媒体查询。但它不能正常工作。我想捕捉大多数 320 像素的手机(iphone4、iphone5、iphone3、asus galaxy 7、s
我开发了一个android应用,我所有android低于api 23的用户都无法连接到服务器,其余的都正常工作,从今天(2020-05-30)开始,在这一天之前多年来一直正常工作。 任何想法是什么原因
我正在上一门加密课,主要是作为学术练习,我一直在尝试获得尽可能高的速度。我发现了一些奇怪的事情,即异或字节数组的成本非常低,但在相同大小的字节数组上使用 arraycopy 的成本更高。我想这一定是一
我启动了一个新的应用程序,它大量使用了 firebase 功能以及支持库。我很快就达到了 65k dex 的限制,尽管考虑到应用程序的简单性,我没有理由应该在那里。我知道我需要排除某些我没有用的依赖项
我在 Lollipop 及以下发生了奇怪的崩溃。尝试从服务器下载文件时出现安全异常,但在运行 Marshmallow 及以上版本的设备中,应用程序不会崩溃。 Logcat: Caused by: ja
我正在构建一个相当简单的网站,我需要它具有一定的响应能力。 现在,当我调整浏览器大小时,导航菜单与 Logo 标题重叠,变得非常困惑。 HTML: Prince Innoce
如演示中所示,maxValue 设置为 2017 年,但图表一直到 2020 年。 如何让图表真正停在 2017 年?它在我的页面上占用了太多空间,因此我想对其进行优化 See demo fiddle
我正在用 python 尝试第二个 Project Euler 问题,想了解为什么我的代码不起作用。 此代码查找低于 400 万的偶数斐波那契数的总和 counter = 2 total = 0 wh
我想回答其中一个问题,这些问题有时是由销售人员试图在预算内进行销售而交给我们开发人员的。 我们有一个客户需要以下内容: 支持 AD 身份验证的文档管理系统(即使服务器可能位于其他位置 - 可能位于 V
我有一系列值(Pandas DF 或 Numpy Arr): vals = [0,1,3,4,5,5,4,2,1,0,-1,-2,-3,-2,3,5,8,4,2,0,-1,-3,-8,-20,-10,
当我创建使用 Google map API v2 的项目时,这条线有问题。 GoogleMap map = ((MapFragment) getFragmentManager().findFragme
如何在 UITableView 下方但在 TabBar 上方放置一个按钮,以便 UIButton 保持静止(不随 tableview 滚动)? 这是一张我想要帮凶的照片:http://i.imgur.
我正在使用 MockMvcResultMatchers 来测试我的 Controller 类。 这是一个示例代码 RequestBuilder request = get("/empl
function randomise(){ var ran_number=Math.floor(Math.random() * 100); return ran_number;
我正在尝试为 iOS9 以下的 NSManagedObjects init(context:) 方法“polyfill”。有没有办法为 iOS10 进行预处理器可用性检查? 这是否有意义,或者是否会出
我对 Web 开发的冒险还很陌生。我在使用的网站上遇到问题。在我达到大约 640px 之前,我的响应式设计没有问题。一旦我达到 640px 或将我的 html 全部压缩到左侧,除了我的主页英雄和导航栏
所以,我遇到的问题真的很难解释,但是,当页面宽度小于 600 像素时,我试图让我的导航行为有所不同。我几乎按照我想要的方式工作,但是当我点击菜单按钮时,当它低于 600px 时,它会在它下面的内容顶部
我在一个多语言网站上工作,我想在它的图标下方放置一个固定语言的菜单 div。我正在使用 Bootstrap 3。
我是一名优秀的程序员,十分优秀!