Vladimir Terziyski
Sep 19, 2010
  8549
(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
Opti ID overview

Opti ID allows you to log in once and switch between Optimizely products using Okta, Entra ID, or a local account. You can also manage all your use...

K Khan | Jul 26, 2024

Getting Started with Optimizely SaaS using Next.js Starter App - Extend a component - Part 3

This is the final part of our Optimizely SaaS CMS proof-of-concept (POC) blog series. In this post, we'll dive into extending a component within th...

Raghavendra Murthy | Jul 23, 2024 | Syndicated blog

Optimizely Graph – Faceting with Geta Categories

Overview As Optimizely Graph (and Content Cloud SaaS) makes its global debut, it is known that there are going to be some bugs and quirks. One of t...

Eric Markson | Jul 22, 2024 | Syndicated blog

Integration Bynder (DAM) with Optimizely

Bynder is a comprehensive digital asset management (DAM) platform that enables businesses to efficiently manage, store, organize, and share their...

Sanjay Kumar | Jul 22, 2024

Frontend Hosting for SaaS CMS Solutions

Introduction Now that CMS SaaS Core has gone into general availability, it is a good time to start discussing where to host the head. SaaS Core is...

Minesh Shah (Netcel) | Jul 20, 2024

Optimizely London Dev Meetup 11th July 2024

On 11th July 2024 in London Niteco and Netcel along with Optimizely ran the London Developer meetup. There was an great agenda of talks that we put...

Scott Reed | Jul 19, 2024