I'm trying to limit the number of managed threads permitted by an ASP.NET MVC application running under IIS7.5 on Windows Server 2008. I've attempted a number of different approaches but none seem to have worked as expected, I need to limit the number of threads as reported by
Threading.Thread.CurrentThread.ManagedThreadId
I also tried changing the ASP/behaviour/limits properties/threads per processor limit but I still get new threads with a different thread id.
I really need a limited number of threads (say 5-10) with the same thread id for each one every time it's used.
At the moment I have the following config file
<configuration>
<system.web>
<applicationPool maxConcurrentRequestsPerCPU="1" maxConcurrentThreadsPerCPU="1" requestQueueLimit="5000"/>
</system.web> </configuration>
pointed to by applicationhost.config
<applicationPools>
<add name="DefaultAppPool" enable32BitAppOnWin64="true" CLRConfigFile="C:\Inetpub\wwwroot\SCRWeb\Data\apppool.config">
<processModel identityType="NetworkService" />
</add>
And yet I still see more than 1 thread id in my application as reported by Threading.Thread.CurrentThread.ManagedThreadId
Any ideas?
Thanks
Related
Problem: Limit the number of threads for each deployed application in a tomcat container. So that no one deployed component can hog all the resources.
In the weblogic world I used workmanagers with a min and max thread constraint, then for each deployment specified the workmanager for that application.
I have read about Executors which can set thread constraints; but only at Connector level. One silly trick available is making sure my clients use different ports for a single tomcat instance, and then organizing different Executors for each Connector, but that seems inefficient.
Question: Are there better solutions than the silly idea proposed?
Example
deploymentA should be allocated minimum 5 threads and maximum 10 threads
deploymentB should be allocated minimum 10 threads and maximum 50 threads
Silly Solution
<Executor name="exeOne" maxThreads="10" minSpareThreads="5" maxQueueSize="10" />
<Executor name="exeTwo" maxThreads="50" minSpareThreads="10" maxQueueSize="10" />
<Connector port="11400" executor="exeOne" />
<Connector port="11500" executor="exeTwo" />
Have clients/users of deploymentA call port 11400 only. Have clients/users of deploymentB call port 11500 only.
I'm trying to disable application pool recycling and changed recycling interval in the app pool configuration to 0. Here's full configuration from .config:
<add name="DefaultAppPool" autoStart="true" managedRuntimeVersion="v4.0">
<recycling logEventOnRecycle="Time, Memory, IsapiUnhealthy, OnDemand, ConfigChange, PrivateMemory">
<periodicRestart time="00:00:00">
<schedule>
<clear />
</schedule>
</periodicRestart>
</recycling>
</add>
Despite that application is still recycled several times a day which can be seen in the event log:
A worker process with process id of '1584' serving application pool 'DefaultAppPool' was shutdown due to inactivity. Application Pool timeout configuration was set to 20 minutes. A new worker process will be started when needed.
This happens on Azure Windows 2008 R2 VM with IIS 7.5.
Is there anything else I need to do to make this setting work?
Possible duplicate of IIS: Idle Timeout vs Recycle and others.
What you are looking for is the idleTimeout which you will find under the process model element in applicationhost.config. Unless you have a strong case I would not recommend disabling the timeout as it is a primary mechanism for releasing unused resources when the site in question is not under load.
If it is idle and shuts down then there is a very small overhead as the new process is spooled up, if this is really an issue then I would suggest investigating some form of persisted cache such disk cache offered by the Application Request Routing IIS Module.
I am trying to retrieve data with all columns from a large SharePoint list (57000+ items and increasing everyday) using webservice.
The problem that I face is that; in the below code, I have heard that the ndRowLimit's recommended value is 5000. When I am setting 57000, I am getting operation timed out.
XmlNode ndListItems = listService.GetListItems(ListName, null, ndQuery, ndViewFields, ndRowLimit, ndQueryOptions, null);
Does anyone know any method using which I can get all the list items and all the columns?
In SharePoint, you can increase the connection time-out setting, follow these steps.
Note By default, the IIS connection time-out setting is 120 seconds.
You can update it via IIS Manager.
Click the Web Site and then the Connection Timeout is under Advanced Settings.
You may run into a further timeout issue which is controlled in the web.config - (always backing that up). But the property that has a default timeout of 110 seconds is under <system.web>
This sets the timeout to 10 minutes.
<httpRuntime executionTimeout="6000" maxRequestLength="51200" />
Finally, after you beat the timeout issue, you'll probably need to (temporarily) adjust the throttling of results at that list or through Central Administration. Here's a great article on the in's and out's of that: http://blogs.technet.com/b/speschka/archive/2009/10/27/working-with-large-lists-in-sharepoint-2010-list-throttling.aspx
I want to develop a logging techniques using CassandraLog4net Appender. I am getting Unavailable exception.
Can u tell me whether i have to create a keyspace or database before running this code?
Also, I am not able to use NODE TOOL When i click on it, it disappears again.
what changes should I make?
Please, find details of configuration of CassendraLog4netAppendar.
<KeyspaceName value="Logging" /><ColumnFamily value="LogEntries"/>\
<PlacementStrategy value="org.apache.cassandra.locator.NetworkTopologyStrategy" />
<StrategyOptions value="Datacentre1:1" /><ReplicationFactor value="1" />
<ConsistencyLevel value="QUORUM" />
<MaxBufferedRows value="1" />
UnavailableException means there aren't enough replicas available to satisfy your query. From your configuration I see a lot of inconsistency in your cluster config. Your log4net appender strategy options point to "Datacentre1"; your topology file lists a bunch of machines in "DC1", "DC2", and "DC3" with multiple racks; your keyspace is set up with only one DC called "DC1"; nodetool shows a single node listening on 127.0.0.1 (which doesn't correlate to any of your configured machines). So you're getting UnavailableException because you're asking for something that doesn't exist. You need to have a consistent configuration across the various pieces.
I am newbie of wcf and mulit-thread, and I write a wcf service hosted in IIS7, in this service there is a long running task (System.Threading.Tasks.Task) which will probably be going to run 20 hours.
But this wcf service always stops to work every 20 minutes.
I make the wcf send email to me when application_stop and application_start is running. Therefore, I receive a email when it start run, and then after 20 minutes, I receive the email show that the service stop.
I really cannot figure out why this happen, why the service stop work every 20 minutes.
Does the wcf services stop every 20 minutes, or the Task thread stop every 20 minutes?
Will any configuration of IIS7 impact wcf running time?
I try to set the receiveTimeout to a every large time amount, and I use asych call to invoke wcf in client side, but this does not make help.
Guys, I really need help, many thanks.
Following code belongs to a website which calls this wcf service
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMailingService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="24.20:31:23.6470000" 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="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:92/MailingService.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IMailingService" contract="MalingService.IMailingService"
name="BasicHttpBinding_IMailingService" />
</client>
</system.serviceModel>
IIS application pool idle default timeout is 20 minutes. You can configure application pool idle timeout by the below steps, which I picked from this article - http://technet.microsoft.com/en-us/library/cc771956(WS.10).aspx
Open IIS Manager.
expand the server node and click Application Pools.
On the Application Pools page, select the application pool for which you want to specify idle time-out settings, and then click Advanced Settings in the Actions pane.
In the Idle Time-out (minutes) box, type a number of minutes, and then click OK.
As rerun said, IIS host is not the best for your scenario, WAS on a Windows Service would be a better option.
IIS is a poor choice for hosting a long running task. If it is at exactly 20 minutes I would think that iis is shutting down the owner thread but that is speculation. I would really suggest moving to a windows service wcf hosting environment.
I use a cheap cron job service service to hit a handler on my app every 5 minutes. This helps keep the pool alive. If you don't want to move away from IIS, this is a quick and "dirty" fix.