New Posts New Posts RSS Feed: PersistenceManager initialization on slow computers
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

PersistenceManager initialization on slow computers

 Post Reply Post Reply
Author
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Topic: PersistenceManager initialization on slow computers
    Posted: 11-Jul-2008 at 7:57am

Below are some links with information on the certificate cache folder “CryptnetUrlCache” as well as an excerpt from a forum that describes it in simpler language. Basically a certificate entry gets created in this folder for any Click Once deployed application as well as website SSL certificates and certificate signed applications installed over the Internet. During the startup of a Click Once application, the certificate is checked to see if it has been revoked. If the certificate is good, the application starts. If a certificate is not found, the application will attempt to connect to the Internet to retrieve the application’s certificate status. If there is no Internet connection, the operating system will assume the certificate is good and the application starts until such time that an Internet connection becomes available so that it can check the CRL lists.

 

Certificate Revocation List (CRL) - Client's Cache - Ohad's Blog:
http://weblogs.asp.net/israelio/arch...14/394513.aspx

Summary of changes to the CryptoAPI certificate chain validation logic in
Windows XP Service Pack 2:
http://support.microsoft.com/kb/887196

 

 

 

C:\Documents and Settings\USERNAME\Application Data\Microsoft\CryptnetUrlCache\Content

and

C:\Documents and Settings\USERNAME\Application Data\Microsoft\CryptnetUrlCache\MetaData


I delete the files in the sub-folders of the CryptnetUrlCache: Content and MetaData.

I find the files in Content and MetaData, the sub-folders of the CryptnetUrlCache folder, really interesting.

The very first time I deleted all the files within these two folders, it really blew my mind...

I looked in some of the files in these folders using Notepad, and it looked like a record of URL History of some kind.
By the name of the folder, "CryptnetUrlCache," I figured they must logically be cache-type files.

I deleted all the files within these two folders. Then I cleaned up my system as usual with my Temp File Cleaners. Rebooted, and defragged. Zowie! My browser windows started opening up so much faster it was simply unbelievable.

So, I asked my friend, 2McAbre, about them...

Per 2McAbre:

Those folders are where XP stores a "verified and certified" websites security certificates for such things like SSL (Secure Socket Layers) logins for if you are paying a bill, or shopping at Amazon.com.

If you want to empty these folders (with msie open) "Click on Tools", select "Internet Options" then click on the "Content" tab.

In the center area where it says "Certificates"… Just click on the Clear SSL button to empty these folders of any temporary certificates.

P.S. The reason it it seems to slow IE down is because XP sort of validates each certificate and sort of "Checks" to make sure they are still valid. So its a good idea to empty the SSL cache every once and awhile.

I took it one step further...

Tools > Internet Options > Content > Certificates button > Intermediate Certification Authorities tab > Highlight an entry > Click on Remove.

Tools > Internet Options > Content > Certificates button > Trusted Root Certification tab > Highlight an entry > Click on Remove.

Tools > Internet Options > Content > Certificates button > Untrusted Publishers tab > Highlight an entry > Click on Remove.

Same here...

Tools > Internet Options > Content > Publishers button > Trusted Root Certification tab > Highlight an entry > Click on Remove.

Tools > Internet Options > Content > Publishers button > Untrusted Publishers tab > Highlight an entry > Click on Remove.

Per 2McAbre:

Yes you can highlight and remove all the others too if you "Really want too. Those are things like when you get the security window when you install windows update site stuff? Where you can check the box that will always "trust" Microsoft?

If you have ever checked one of those boxes there will be a "trust" certificate in one of these areas. Also trusted sites are kept recorded in one of these areas as well as "sites you don't want anything to do with".

Probing deeper, figured out all this has to do with Tools > Internet Options > Advanced > Scroll down to Security section >
"Check for server certificate revocation (requires restart)"

Specifies whether you want Internet Explorer to check an Internet's site certificate to see if it has been revoked before accepting it as valid.

I chose to UNCHECK that particular option.

As it turned out, it doesn't hurt to clear all that out. Because I did, and then I went directly to Windows Update...and what do you suppose happened? The entries needed for Windows Update were recreated.

 

Back to Top
vkh75 View Drop Down
Newbie
Newbie


Joined: 15-Jun-2007
Location: Ukraine
Posts: 14
Post Options Post Options   Quote vkh75 Quote  Post ReplyReply Direct Link To This Post Posted: 10-Jul-2008 at 2:48am
It seems I have found the way to reproduce my problem.
 
1) Install a DevForce Express application on the target machine using ClickOnce technology.
2) Delete %SystemDrive%\Documents and Settings\User Profile\Application Data\Microsoft\CryptnetUrlCache folder.
3) Make sure the computer is on LAN but has no internet connection.
4) Run the application.
 
The app starts after some delay and the folder that was deleted is not created.
But if the computer has the internet connection then the folder gets created and the app starts fast.
 
 
Back to Top
vkh75 View Drop Down
Newbie
Newbie


Joined: 15-Jun-2007
Location: Ukraine
Posts: 14
Post Options Post Options   Quote vkh75 Quote  Post ReplyReply Direct Link To This Post Posted: 19-Oct-2007 at 3:02pm

Finally, I have found what was causing the perfomance hit and it seems it has nothing to do with PersistenceManager...

%SystemDrive%\Documents and Settings\User Account\Application Data\Microsoft\CryptnetUrlCache

The absence of this folder and its contents is causing a long time delay in my application. I still don't khow why this folder gets created (and recreated if deleted) on some computers/profiles and does not on the others, but now I can overcome the problem with just copying this folder from other pc.



Edited by vkh75 - 19-Oct-2007 at 3:02pm
Back to Top
vkh75 View Drop Down
Newbie
Newbie


Joined: 15-Jun-2007
Location: Ukraine
Posts: 14
Post Options Post Options   Quote vkh75 Quote  Post ReplyReply Direct Link To This Post Posted: 18-Oct-2007 at 4:04am
kimj, thank you for information. I will contact support.
Just before writing this I did a little experiment. I completely reinstalled Win2000 on a test machine (PIII 450MHz, 192Mb), installed MS Installer 3.1 + Framework 2.0 + MDAC 2.8. Then I created a simple app that contains the only one Form1 with no controls on it. Here is Form1 class code:

Imports IdeaBlade.Persistence

Public Class Form1

     Private pm As PersistenceManager

End Class
 
I published the app via ClickOnce and installed it on my test machine. Everything worked fine and Form1 was shown almost immediately after the app start.
Then I substituted this line:
Private pm As PeristenceManager
with this one:
Private pm As PersistenceManager = Nothing
and the Form1 appeared in 15 seconds after I started my test app...
 
Also the trick with disconnection from the net worked. In both cases the Form was shown immediately.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 15-Oct-2007 at 2:49pm
So you replaced the offending line to now read:
  mManager = New PersistenceManager(False)
 
and still see the delay?  Other initialization activities during PM construction include probing for datasource key resolvers and ID generators, and trace file logging initialization.  I really don't know what could be causing the problem in your environment, but you can contact support and provide a sample which reproduces the problem if you'd like further help.
 
Your statement that there is no delay when starting your application after getting disconnected from the network is also puzzling, since this would seem to be situation where you'd expect a delay....
 
Back to Top
vkh75 View Drop Down
Newbie
Newbie


Joined: 15-Jun-2007
Location: Ukraine
Posts: 14
Post Options Post Options   Quote vkh75 Quote  Post ReplyReply Direct Link To This Post Posted: 14-Oct-2007 at 10:36am

kimj, I have tried to create the PersistenceManager as you suggested:

Dim pm As New PersistenceManager(False)
 
but it gave me the same long time delay. I have also noticed that if I got disconnected from the network and then started my app, there was no delay...
 
So far I'm very puzzled... Confused
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 12-Oct-2007 at 7:40pm
PersistenceManager.DefaultManager will automatically try to connect to the PersistenceService.  If you don't really need the PM to be connected during logon, construct the PM manually using one of the overloaded constructors which accepts a shouldConnect flag, like this:

PersistenceManager pm = new PersistenceManager(false);

P.S. I'm not sure why the connection is taking so long, but that's a (slightly) separate issue.
Back to Top
vkh75 View Drop Down
Newbie
Newbie


Joined: 15-Jun-2007
Location: Ukraine
Posts: 14
Post Options Post Options   Quote vkh75 Quote  Post ReplyReply Direct Link To This Post Posted: 12-Oct-2007 at 2:39pm

No, I used ClickOnce deployment. Here is some code...

The entry poin for my app is sub main:
 
Public Class Program
 
    Public Shared Sub Main()
        Application.EnableVisualStyles()
        Application.SetCompatibleTextRenderingDefault(False)
 
        If LoginForm.Login() Then
            Application.Run(New MainForm())
        End If
    End Sub
 
End Class
 
LoginForm Class:
 
Public Class LoginForm
 
    Private mManager As PersistenceManager
 
    Private Sub New()
        InitializeComponent()
        mManager = PersistenceManager.DefaultManager
    End Sub
 
    Public Shared Function Login() As Boolean
 
        Dim aLoginForm As New LoginForm()
        Dim aDialogResult As DialogResult = aLoginForm.ShowDialog()
        aLoginForm.Dispose()
        Return Windows.Forms.DialogResult.OK
 
    End Function
 
    Private Sub OK_Click(...) Handles btnOK.Click
        DoLogin()
    End Sub
 
    Private Sub Cancel_Click(...) Handles btnCancel.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
    End Sub
 
    Private Sub DoLogin()
        If Not InputIsValid() Then Return
        Try
            'Some authentication code...
            Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Catch pException As Exception
            MessageBox.Show(pException.Message)
        End Try
    End Sub
 
End Class
 
If I comment out the red line code, my LoginForm shows without delay, otherwise it takes time depending on machine config...
 
Originally, there was no PersistenceManager in the LoginForm and it showed up fast. I just placed the creation of PM into this form for testing purposes.
 
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 12-Oct-2007 at 1:47pm
Did you run the applications inside of Visual Studio?
Back to Top
vkh75 View Drop Down
Newbie
Newbie


Joined: 15-Jun-2007
Location: Ukraine
Posts: 14
Post Options Post Options   Quote vkh75 Quote  Post ReplyReply Direct Link To This Post Posted: 12-Oct-2007 at 1:03pm
I have developed a small application with DevForce Express and it runs very fast on my development machine (C2D E4400, 1Gb RAM).
After I runned the app on a Pentium-III 750Mhz, 256 MB RAM PC it took about 30 seconds for a Main Form to load... I found out that it was this line of code that made my app freeze for such a long time:
 
Dim mPersMgr As PersistenceManager
mPersMgr = PersistenceManager.DefaultManager
 
I checked the startup time of the app on about 5 machines with different configurations and it varied from 2 seconds to 40 seconds.
 
Can someone  explain me what is happening while PersistenceManager.DefaultManager is being created and why it takes so long time. I started the Task Manager and it didn't register high CPU or RAM load...
 
Thanks in advance.
 
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down