简体   繁体   English

Sharepoint工作流程性能问题

[英]Sharepoint workflow performance Issue

I don't have experience with sharepoint developments, I was asked to have a look at a workflow performance. 我没有Sharepoint开发方面的经验,因此要求我查看工作流程的性能。 After some tracing, i found which part takes too much time to execute: 经过一些跟踪,我发现哪个部分执行花费太多时间:

using (var site = new SPSite(WorkflowWeb.Site.ID, workflowProperties.OriginatorUser.UserToken))
        {
            using (var web = site.OpenWeb(WorkflowWeb.ServerRelativeUrl))
            {
                var list = web.Lists[WorkflowItem.ParentList.ID];
                var item = list.Items[WorkflowItem.UniqueId];


                item[new Guid("{54GH32R2-HG66-654a-KKKK-456FFF864654}")] = SPUtility.GetLocalizedString("$Resources:Assigned_Car", "RealB", WorkflowWeb.Language);
                item[new Guid("{54FG6215-9584-123g-KJHG-456FFF864654}")] = DateTime.Now;
                item.Update();
            }
        }

This part takes around 5 min to execute. 这部分大约需要5分钟才能执行。 Any tip to improve the performance? 有什么技巧可以改善性能吗?

As I mentioned, I have no SP experience, I also don't have much knowledge of what the workflow is doing, I just have to solve it quick and dirty. 正如我提到的那样,我没有SP经验,对工作流程的工作也不了解,我只需要快速而轻松地解决它。

Under normal circumstances the presented piece of code cannot take 5 minutes to execute. 在正常情况下,所提供的代码段无需花费5分钟即可执行。 Performace-wise, to execute this code, even when a previously not cached SPSite needs to be opened, is a sub-second matter. 就执行而言,即使需要打开以前未缓存的SPSite ,执行此代码也SPSite不到一秒的时间。

What does take up to 5 minutes in SharePoint 2010 with default configuration of owstimer (the process executing workflows asynchronously) is the delay between workflow engine invocations which in turn execute workflows. 什么需要长达5分钟的SharePoint 2010的默认配置owstimer (工作流执行异步的过程)是工作流引擎调用这反过来执行工作流程之间的延迟。 Depending on the way you measure the 'performance' ('run-time duration' would be a much better term to use here) of the workflow this idle time may be included in your results. 根据您对工作流的“性能”(“运行时间”是一个更好的术语)的衡量方式,此空闲时间可能会包含在您的结果中。


Side note: 边注:

I have no SP experience, I also don't have much knowledge of what the workflow is doing, I just have to solve it quick and dirty. 我没有SP经验,对工作流程的工作也不了解,我只需要快速又轻松地解决它。

Then it's a very bad idea to tacked with SharePoint beyond basic learning tasks. 然后,在基本学习任务之外再使用SharePoint是一个非常糟糕的主意。 Performance tuning and troubleshooting definitely are not tasks suitable for people with a complete lack of knowledge and experience with the platform. 性能调优和故障排除绝对适合完全缺乏该平台知识和经验的人使用。 SharePoint is a very complex platform and its behaviour is, sometimes, far from straightforward. SharePoint是一个非常复杂的平台,有时其行为远非那么简单。 You should learn and earn experience with SharePoint on something much less complicated. 您应该学习和获得SharePoint方面的经验,而这要简单得多。

Somehow It's now faster by changing: 现在可以通过更改来更快:

var item = list.Items[WorkflowItem.UniqueId];

To

var item = list.GetItemByUniqueId(WorkflowItem.UniqueId);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM