Performance Impact of File Attachments in InfoPath Forms
I was recently looking into the impact of increasing the Session State size associated with InfoPath forms. The main reason for the investigation was to allow users to attach files up to 20MB in size to InfoPath forms in SharePoint 2010. InfoPath does leverage the State Service to store transient data, but I was mainly interested in the performance impact of attaching larger files. I first started out by confirming that File Attachments are considered transient data. The above linked article seemed to indicate they were, but it’s always good to confirm. During this test, I also confirmed that it does not matter what type of InfoPath form you create. If you start out with a Blank Form, or a SharePoint List Form, the InfoPath File Attachment control stores the entire attachment into the State Service database until the form is saved. I did the confirmation by running the following query against the State Service database:
Select Datalength([ItemData]) as ItemDataLength, *
In my test, I had a 22MB WMV file I was attaching to my form. Before the file was attached, the ItemDataLength was close to 0. After attaching the the file, the ItemDataLength was a little over 22MB. Saving the form resulted in the ItemDataLength,dropping close to 0. Transient data…confirmed.
Next up, what areas are impacted by this work? In order for the session data to be persisted in the database, the data is serialized. This process will use up CPU on the machine handling the web requests. The more data you store, the longer the CPU will be hit for a given request. Once the data is serialized, it is written to the State Service database. With a larger session, and a significant number of users, you could see quite a bit of churn on the disks hosting the State Service database along with your CPU usage.
With the above information there are a couple concerns:
- How big will the State Service database get?
- Will the amount of traffic to the State Service database impact other databases on the same set of disks?
- Will the spike in CPU while serializing the files negatively affect the performance of the farm?
Unfortunately, there is no magic number for this scenario, the behavior will depend on your specific scenario and environment. To fully understand the impact, you would want to start out with the following:
- What is the size of file attachments users are planning on uploading?
- How many users are planning to do this type of work?
- How often users will be performing this work?
- How long do users typically leave the form open?
Once you understand the above information, you’ll start getting an idea of the general impact. For example, if you have 1-2 users uploading a large file on an under-utilized farm at the same time, you probably won’t notice the impact. However, if you have a high volume of InfoPath form usage with large file attachments, you will notice the CPU hit. Any databases hosted on the same disks as the state service will likely notice as well.
The only way to find out what the potential impact will be is to test your scenario and analyze the results. Be sure to append your results to your current farm performance to ensure you are below your thresholds for performance. For example, if the CPU on the web servers is running around 5%, and testing shows an increase of 10-15%, you probably don’t have much to worry about. If testing shows a 60-70% increase, you would probably have reason for concern.