November Happy Hour will be moved to Thursday December 5th.

Vladimir Terziyski
Sep 19, 2010
  8672
(0 votes)

EventReplication service with TCP

When dealing with multiple servers in load balancing scenario, you have to use EventReplication service in EPiServer in order to synchronize them. By default EPiServer comes with UDP synchronization but this won't work if multicast UDP is disabled by network administrators. The second options is to use TCP. If the version of EPiServer allows it you can enable port sharing:

   1: <bindings>
   2:     <nettcpbinding>
   3:         <binding name="PortBinding" portSharingEnabled="true" />
   4:     </nettcpbinding>
   5: </bindings> 
Here you can check more about specific implementation details: http://world.episerver.com/FAQ/Items/Multicast-UDP-not-working/
http://blog.fredrikhaglund.se/blog/2009/09/22/episerver-cms-how-to-configure-remote-events-with-many-servers-and-firewalls-between-them/

However when using specific ports for different endpoints, only one port per endpoint is allowed. If you set to endpoints to use the same port - the following exception will be thrown:
"System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted"
This exception can occur even when using different ports. Consider the following example:
I've created a page which has method that freezes the current thread for fifty seconds: Thread.Sleep(50000)
After the thread has been put to sleep, I've recycled the application pool manually. The next request which I've made to a different page in the same website returned the exception, which I've mentioned before. Why is this happening? There is feature in IIS 6 and IIS 7 called "overlapped recycling". When activated if application pool is recycled, the next request will create a new worker process (w3wp) even if the old one is not terminated yet. This way the two processes will try to use the same port.
By default the application pools is recycled every 1740 minutes. This means that if your website is performing long running operation after recycle the exception can be thrown. To disable overlapped recycling in IIS6 you have to set DisallowOverlappingRotation metabase property to true http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/24e3c22e-79a9-4f07-a407-dbd0e7f35432.mspx?mfr=true. In IIS7 select the application pool -> Advanced Settings -> Recycling section and set Disable Overlapped Recycling it to true. Also I recommend to set a specific time for recycling the website when it is less visited. This is because the worker process, which handles the request after recycle will wait for terminating the first one and is better to set it to a time when the website visit rate is lower. 

Sep 19, 2010

Comments

Sep 21, 2010 10:33 AM

Thanks!

Very interesting to know that this can happen. I think it applies both to the scenario when you use specific ports and port sharing since port sharing also requires a unique name of the end point (path changes instead of port number). Can you confirm?

/Fredrik

Sep 21, 2010 10:33 AM

Yes, you are right. Unique name of the end point is required per website. I've tried using the same end point in two websites and it failed with the following exception: "The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: the URI is already registered with the service"

Pankaj kr Prasad
Pankaj kr Prasad Mar 2, 2011 10:48 AM

Thanks!

I had same issue in one of the load balance site and the post was of great help.

Mar 14, 2012 08:35 PM

Me too Pankaj - nice to see you on here btw :)

Please login to comment.
Latest blogs
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog