Skip to content

July 11, 2011

HTTP 1.1 Connection Timeouts, Load Balancers, and Site Creation

HTTP 1.1 [RFC2616] does some really amazing things for performance – but most of that’s lost on the average consumer. In HTTP 1.0 we created a request and when the response was torn down we tore down the HTTP connection – and the underlying TCP channel. That doesn’t sound like a big deal. Really, how much effort is it to form a TCP channel? Not a ton, however, it does require what amounts to a three-phase commit. Do that handshake enough times and it starts taking a non-trivial amount of time.

With HTTP 1.1 we get a persistent connection. After the request/response the connection is left open. The connection is then reused for the next request. When pages have 20 or more requests on them this can make a difference. Why 20 or more requests? CSS, JavaScript, and Images are used by nearly every page.

Even better is we get RFC4559. Why do we care? Well among other things that RFC adds persistent authentication to the HTTP 1.1 connection. So we don’t have to authenticate each request. We can do it once and that authentication is valid while the HTTP 1.1 connection stays active. It reduces the load in validating the users credentials.

This is all goodness but I ran into a problem where SharePoint had some really odd behavior when creating sites and sub-sites. With Silverlight enabled we would get a generic error, or the site being created was a duplicate. These errors seemed to occur while the Silverlight app was calling addgallery.aspx. If we disabled Silverlight and we created the site from the web UI we would get processing and instead of a redirect to the site we’d get a lovely less than (<) sign.

We were looking at ways to control the application of themes to the page – since this client allowed their users to select multiple themes and we needed to apply the default value. This takes a while. In our case with the site creation, the theme, master pages, etc. takes about 45 seconds to create a site.

The problem, as it turns out, was that the load balancer was timing out the sessions at 30 seconds. The result was that in the middle of a stream of requests, the rug was being pulled out from underneath the client. The behavior was to record the error but since it’s really unexpected it was providing generic errors – or the expected issue of a duplicate site in one case. The web UI simply didn’t know how to cope and stopped short of the redirect.

The solution was to match the Load Balancer setting to the IIS setting of 120 seconds for HTTP 1.1 timeout. Once we did that the problem seems to have disappeared.

SharePoint Workflow UserDefinedWorkflowMaximumComplexity

I’ve had a couple of questions about this in the last few months so I wanted to provide some information on what’s happening with Workflow 3.5 and what’s this silly limit for the maximum complexity – and worse yet, how did I hit it?

So making a long story short, Workflow 3.5 compiles the XOML that SharePoint Designer generates into a DLL. When that DLL is called there’s a method that creates the workflow object graph. When it’s doing this it pushes a bunch of “stuff” on to the stack. If it pushes too much on the stack we get a stack overflow. How much of the “stuff” does it take? It depends. However, at 10,000 items it gets tight. If we get a stack overflow it dumps the thread and aborts – which is, of course, a bad thing. So SharePoint put a limit in for the maximum number of items that can be in a workflow for SharePoint to ask for it to be compiled. That number is 7,000 by default but can be adjusted. (Caveat emptor)

So what is this “stuff” of which I speak? Well according to a good source, it’s activities, bindings, variables, and rule-references. Note I said activities, not actions. If you’ve seen one of my workflow presentations you’re used to me creating a simple workflow with just an approval action and then importing it into Visual Studio to find 315 activities. All total, there’s roughly 1,000 activities, bindings, variables, and rule-references in a single “approval” action in SharePoint Designer. So clearly if you did eight different “approvals” in a single workflow you’d exceed the default limit. This also applies for custom task processes.

I’m assured that you can get multiple approvals to work inside of a single “approval” activity – but it’s not as easy as plunking down another activity task – so it’s not impossible to do eight-level approvals with SharePoint Designer, it’s just that it gets more challenging.

If you do “need” to change the value of UserDefinedWorkflowMaximumComplexity – it’s a property on the web application. (Have I encouraged you not to do it yet?)

Drive: The Surprising Truth About What Motivates Us

Book Review-Drive

What makes you get up in the morning? Chances are it’s not your desire to conquer the world, unless you’re The Brain. One of the really crazy parts about working with SharePoint adoption is realizing how little we know about motivating users. In his book Drive Daniel Pink tears apart what we think we know about motivation. We all know that carrots and sticks work – or do they? They work when the task being performed is algorithmic – predictable – but they don’t seem to work as well when the task is heuristic. In other words, carrots and sticks work when you don’t have to think. Given that most of the folks that I work with have to think, carrots and sticks don’t seem to be the right answer.

Economics would seem to be the study of money – but it’s not. Economics is the study of human behavior – as it relates to money. We used to think that bonuses lead to better performance but there is a plenty of research now that says that this isn’t the case. It turns out that people don’t always behave in their own best financial interests – and those that do create their own problems (think financial crisis, housing melt down, etc.) There’s a standard economic experiment called the Ultimatum game. In the game there are two parties. The first person gets to decide how to split the money. The second person gets to decide whether either of the parties gets to keep their share. If they second party doesn’t like the offer they both walk away with nothing. If you give this to an economist who believes that people always behave in their own best interests would think that as long as the second person is going to get more than nothing they would always opt that both people would get money. However, in most case when the split is less than 20% for the second party they reject the offer and both parties walk away with nothing. Clearly there’s more going on here than financial best interests.

It turns out that there’s plenty of research that says that we just don’t do that. Larger rewards for larger performance can sometimes lead to reduced performance. Irrational – yes. True – Yes.

Maslow would be confused since his hierarchy of needs doesn’t make any sense when you consider that people are willing to be artists and starve to get the freedom and mastery of their craft that they want. There’s something going on that Maslow didn’t see. There’s an internal motivation and intrinsic drive happening. The crazy part is that this intrinsic drive doesn’t have a chance against the carrot-and-the-stick. It’s really turned upside down. Consider the act of giving blood. It’s an important part of our healthcare system. There are all sorts of rewards for giving blood but money is rarely one of them. Why? People give blood because they want to help others. If they’re paid for it they don’t believe their motives are pure. If someone is paid for giving blood they will give less. (As a sidebar it is OK if that money gets diverted to a charity.)

Drive puts forward the idea that there are three key things that people really want:

  • Autonomy – People want to be in control of their own destiny and their world. The dimensions of autonomy are: task, time, technique, and team.
  • Mastery – People genuinely want to become a master of what they do. They want to feel like they’re a master of a topic. Of course there’s no such thing as complete mastery – but it’s a nice place to fix your desire.
  • Purpose – People want to believe that their life has a purpose or a meaning.

It’s refreshing to give my thoughts about how to motivate people a dust-off to see how valid they really are – and how they fail me.

Recent Posts

Public Speaking