NHybernate, the Parallel Framework, and SQL Server

Posted by andy on Stack Overflow See other posts from Stack Overflow or by andy
Published on 2010-05-25T00:32:18Z Indexed on 2010/05/25 0:41 UTC
Read the original article Hit count: 383

Filed under:
|
|
|

hey guys, we have a loop that:

1.Loops over several thousand xml files. Altogether we're parsing millions of "user" nodes.

2.In each iteration we parse a "user" xml, do custom deserialization

3.finally, in each iteration, we send our object to nhibernate for saving. We use:

.SaveOrUpdateAndFlush(user);

This is a lengthy process, and we thought it would be a perfect candidate for testing out the .NET 4.0 Parallel libraries. So we wrapped the loop in a:

Parallel.ForEach();

After doing this, we start getting "random" Timeout Exceptions from SQL Server, and finally, after leaving it running all night, OutOfMemory unhandled exceptions.

I haven't done deep debugging on this yet, but what do you guys think. Is this simply a limitation of SQL Server, or could it be our NHibernate setup, or what?

cheers

andy

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about nhibernate