SaaS CMS has officially launched! Learn more now.

Vladimir Terziyski
Sep 19, 2010
  8538
(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
Creating Custom Actors for Optimizely Forms

Optimizely Forms is a powerful tool for creating web forms for various purposes such as registrations, job applications, surveys, etc. By default,...

Nahid | Jul 16, 2024

Optimizely SaaS CMS Concepts and Terminologies

Whether you're a new user of Optimizely CMS or a veteran who have been through the evolution of it, the SaaS CMS is bringing some new concepts and...

Patrick Lam | Jul 15, 2024

How to have a link plugin with extra link id attribute in TinyMce

Introduce Optimizely CMS Editing is using TinyMce for editing rich-text content. We need to use this control a lot in CMS site for kind of WYSWYG...

Binh Nguyen Thi | Jul 13, 2024

Create your first demo site with Optimizely SaaS/Visual Builder

Hello everyone, We are very excited about the launch of our SaaS CMS and the new Visual Builder that comes with it. Since it is the first time you'...

Patrick Lam | Jul 11, 2024