Windows Workflow Foundation 3


While() activity a cpu hog


I have a While activity that is driving a custom activity I created. Everything runs fine except it is running the cpu at 100%. I tried a short sleep in my custom activity to see if that would free up cycles. It didn't. I also dropped the thread priority for the workflow, but that didn't seem to matter either. I'm not a thread expert, so I'm out of ideas. Can anyone give me suggestions?
Thanks,
Matt
Hi,
I could reproduce the same using both a Workflow using a while activity and a regular console application that was using a while loop. However, in both cases, if I started up other applications or performed other activities, the utilization of the CPU was granted to the other applications and the system did not bog down.
Did your system bog down or did performance degrade? If you have a long running tight loop in a while activity that does not consist of only your custom activity executing (and it is not a composite custom activity) then you might be better served to take the looping out of the WhileActivity and into a pure code construct.
I will research this further for you and post back additional details, but if you could reply with additional details on your scenario that would be great.
Thanks,
Steve Danielson [Microsoft]This posting is provided "AS IS" with no warranties, and confers no rights.
Hi,
I could reproduce the same using both a Workflow using a while activity and a regular console application that was using a while loop. However, in both cases, if I started up other applications or performed other activities, the utilization of the CPU was granted to the other applications and the system did not bog down.
Did your system bog down or did performance degrade? If you have a long running tight loop in a while activity that does not consist of only your custom activity executing (and it is not a composite custom activity) then you might be better served to take the looping out of the WhileActivity and into a pure code construct.
I will research this further for you and post back additional details, but if you could reply with additional details on your scenario that would be great.
Thanks,
Steve Danielson [Microsoft]This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Steve.
You're right, the system itself isn't bogging down. I'm mainly concerned that running at 100% is going to come back to hurt me in the future if/when I have many workflows running on one server, along with my database, my web server, etc. Of course if it's yielding gracefully then that shouldn't be a problem...
Also yes, like you say, this behaves like a coded while loop, although I was hoping for something adjustable from outside of the code...Like a "loop frequency" setting.. something a "user" could control instead of me. More like a Timer I suppose.
One thing worth noting is that when I posted originally I had my workflow running from a console app. I've since moved it over to a Windows app and now I'm seeing the workflow idle at around 75% usage.
Thanks for your quick response!
Matt
 

Related Links

Problem with x:Class and CreateWorkflow
Activity property resets back to default inside while activity
Designer does not maintain scroll position returning back from eventdrivenactivity to root designer surface in WF 3
InvokeWorkflow inside ReceiveActivity does not start async
stop runnign an istance of a work flow
WorkFlow will not start. Stuck on workflowRuntime.CreateWorkflow?
Is there the ability for business users to modify the workflow?
How to: Activity Data Bind a collection object, not it's contents.
Problems with Ownership, Timers etc
CustomPersistedService
Workflow and Development Modes
My workflow deriving from my own workflow base class - will it work?
Object To Object Map Activity
Distributed Transaction with WWF
MaxInstances WorkflowRuntime
Remote workflow tracking

Categories

MSDN
Windows Desktop Develo...
Apps for Office and Sh...
.NET Framework
Visual FoxPro
HealthVault
JScript and Scripting
Internet Explorer Deve...
Smart Device Development
Windows Forms
Windows Live Developer
Microsoft Research
Project Server
Silverlight
Expression
Archived Forums C-D
Archived Forums I-L
Archived Forums N-R
In-App Advertising (Ad...
Skype for Business
Software Entwicklung f...
Announcements for all ...
Forums Issues (not pro...
Visual C++
Visual Studio Setup an...
Visual Studio Integrate
Visual Studio Editor
MSBuild
Promote Your App
AdSDK Integration & Ad...
General Windows Deskto...
Outlook for Developers
Open XML Format SDK
SharePoint Legacy Vers...
Workflow Manager 1.0
Azure BizTalk Services
Azure CDN
Azure Key Vault
Azure Log Analytics
Azure Mobile Engagement
Azure SQL Data Warehouse
Azure IoT Hub
.NET Framework Setup a...
Windows Presentation F...
Windows Communication ...
Team Foundation Server...
Team Foundation Server...
BizTalk Server Adapter...
SyncFx - SyncToy-File ...
SyncFx – Microsoft Syn...
Microsoft Robotics - C...
Microsoft Robotics - H...
SQL Server Reporting S...
SQL Server Tools
SQL Server SMO/DMO
SQL Server Replication
Database Design
Power Pivot
Standard 7: Components...
Standard 7: Misc
Windows Embedded 8.1 I...
Dynamics 365 for Custo...
Orchard - Help and Sup...
WebsitePanel - Support
Developing for the Mob...
Known Issues for Windo...
Microsoft Automatic Gr...
Microsoft Lync Server ...
Silverlight Controls a...
MVVM / ViewModel Patte...
PivotViewer Control wi...
Silverlight for Window...
Expression Design
Connected Services Fra...
Project Online General...
.NET Framework 4 Appli...
.NET Framework 4 setup...
.NET Remoting and Runt...
Azure Troubleshooting,...
Direct3D 10
Feedback for Visual Ba...
LINQ Project General
LightSwitch HTML Clien...
Microsoft Security Dev...
Model-Based Testing wi...
Popfly Bugs and Sugges...
Search Server: Frequen...
Search Server: Known B...
Search Server: Report ...
SQL Server 2014 High A...
Team Foundation Server...
Tools for Windows Stor...
UI Design for Windows ...
Visual C++ 2008 (Pre-r...
Visual C++ Express 200...
Visual C++ MFC and ATL
Visual Studio Editor i...
Visual Studio UI Autom...
WCF Data Services (Pre...
Windows CardSpace ('In...
Windows MultiPoint Mou...
Building Windows Store...
XML in Visual Studio 2...
Kinect for Windows v1 SDK
.NET Native Preview
SQL Server 2016 Preview
Cortana Skills Kit

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile