This section explains how to increase the number of simultaneous connections between the client and CyberSource.
By default, you can create only two simultaneous connections to an HTTP server. By increasing the number of connections, you can avoid a backlog of requests during times of very high transaction volume. Microsoft recommends for the connection limit a value that is 12 times the number of CPUs. For example, if you have two CPUs, you can set the connection limit to 24. To determine the optimum setting for your application, make sure to run performance tests.
You can increase the number of connections in many ways, for example by using an application- or server-specific configuration file where you can change the setting for a single or for all hosts. The examples below describe briefly some of the methods that you can use to increase connection limits.
When set to a value other than -1, the cybs.connectionLimit setting in the client increases the limit for the host where you are sending the request by executing these statements on your behalf:
ServicePoint sp = ServicePointManager.FindServicePoint(uri); sp.ConnectionLimit = config.ConnectionLimit; |
You can set the connection limit by using .NET's <connectionManagement> tag. In this example, the connection limit for CyberSource's test and production hosts is 12 while the limit for all other hosts is 2:
<system.net> <connectionManagement> <add address = "https://ics2wstesta.ic3.com" maxconnection = "12" /> <add address = "https://ics2wsa.ic3.com" maxconnection = "12" /> <add address = "*" maxconnection = "2" /> </connectionManagement> </system.net> |
You can set the connection limit for all hosts to which your application is connected before a connection is made by using the following line in your start-up code:
ServicePointManager.DefaultConnectionLimit = your_value_here;
For more information on these and other methods to increase the connection limits, see the following Microsoft documentation:
nManaging Connections in the .Net Framework Developer's Guide (http://msdn2.microsoft.com/en-us/library/7af54za5.aspx).