EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Adding files to a SolFSStorage is slow

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
Posted: 05/24/2007 08:54:03
by Hülstede Peter (Basic support level)
Joined: 05/24/2007
Posts: 9

I recently started working with the SoldFileSystem. To learn how to work with it I started adding functions the SolFSExplorer to import files from a directory into a SolFS archive. With about 10 files everything works fine but when I try to add more files, the process gets awfully slow and sometimes I see exceptions like this:

Managed Debugging Assistant 'ContextSwitchDeadlock' has detected a problem in '...\SolFSExplorer\bin\Debug\SolFSExplorer.vshost.exe'.
Additional Information: The CLR has been unable to transition from COM context 0x37d1f8 to COM context 0x37d368 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.

The code I use look very similar to the example code:
First I create the SolFSStorage

Storage = new SolFSStorage();
Storage.FileName = storageName;
Storage.AutoCompact = 0;
Storage.CaseSensitive = false;
Storage.PathSeparator = '\\';
Storage.UseTransactions = true;
Storage.UseAccessTime = true;
Storage.PageSize = 512;
Storage.StorageEncryption = SolFSEncryption.ecNoEncryption;
Storage.FilesEncryption = SolFSEncryption.ecNoEncryption;
Storage.Compression = SolFSCompression.crDefault;


And then I iterate through the directory and add subdirectories with


File are added with

using (Stream stream = new FileStream(fullName, FileMode.Open, FileAccess.Read, FileShare.None))
    string entryName = relDir + "\\" + f.Name;
   using (SolFSStream solFSStream = new SolFSStream(Storage, entryName, FileMode.Create, FileAccess.Write, FileShare.None))
      while (true)
         int len = stream.Read(buffer, 0, blockSize);
         if (len <= 0)
         solFSStream.Write(buffer, 0, len);

The problem seems to lie in the actual solFSStream.Write call. If I comment it out, the program works as fast as expected.
Importing the same directory with the SolFSExplorer, that is distributed in binary format, is also fast.

What am I doing wrong? Thanks in advance for any hints.
Posted: 05/24/2007 09:02:43
by Eugene Mayevski (EldoS Corp.)

You are probably using an evaluation version which has speed limitations. Also, adding files to the resizeable storage causes the storage file to be resized with any operation and this is indeed slow, especially as you are using page size of 512 bytes (the smaller page size is, the slower most operations are).
As for the errors, it's not possible to say anything without seeing the complete test project. You can submit it to HelpDesk

Sincerely yours
Eugene Mayevski
Posted: 05/24/2007 09:11:52
by Hülstede Peter (Basic support level)
Joined: 05/24/2007
Posts: 9

I call SetRegistrationKey as the first line of the main program, Encryption works and I don't see the nag screen.

I tried using a pagesize of 4096 and the default value (by not setting the property). It made no difference. With the binary SolFSExplorer I also used a resizeable storage and the dependence on the Pagesize is barely noticeable.

I also tried to set UseTransactions and UseAccessTime to false, but it also didn't change anything.

I think I try to make a small project that reproduces the problem and send it to the help desk.

Thank you,
Peter Hülstede

Posted: 05/29/2007 05:01:38
by Hülstede Peter (Basic support level)
Joined: 05/24/2007
Posts: 9

I experimented a bit further and found out that it is really the SolFSStorage.PageSize parameter that matters.
Adding 10 MB of random data uses more than five seconds with a PageSize of 512 Bytes and less than 2 seconds with a PageSize of 1024 Bytes.
Posted: 12/04/2010 08:22:52
by M Kashif (Basic support level)
Joined: 12/01/2010
Posts: 1


I am facing similar issue. Did you find any solution? is this due to evaluation key where speed made limited.

M Kashif.
Posted: 12/04/2010 08:55:54
by Eugene Mayevski (EldoS Corp.)

The key in SolFS 4.5 doesn't have speed limitations.

Also there's no "issue" here. The dynamically-sized storage needs to extend itself with each file being added. This does take time. You need to resize the storage before adding files (use DiskSize property for this).

Sincerely yours
Eugene Mayevski
Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.



Topic viewed 5966 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!