« Previous Next »

Thread: Pre-caching images

Last post 09-15-2008 11:02 AM by perevera. 7 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (8 items)

Sort Posts:

  • 09-10-2008, 3:48 AM

    • perevera
    • Not Ranked
    • Joined on 09-10-2008, 3:29 AM
    • Posts 5

    Pre-caching images

    We have  a problem when first accessing our web application: loading all the images that compose the application is too slow.

    It looks like it takes two hits to disk in order to get the bunch of images needed, as you can see in this IIS log:

    15:03:01 127.0.0.1 GET /ALUMonitoring/MonitoringAdminFrame.aspx 200
    15:03:01 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304
    15:03:01 127.0.0.1 GET /ALUMonitoring/MonitoringAdmin.aspx 200
    15:03:01 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304
    15:03:01 127.0.0.1 GET /ALUMonitoring/images/Configuracion.png 304
    15:03:01 127.0.0.1 GET /ALUMonitoring/images/Recursos.png 304
    15:03:01 127.0.0.1 GET /ALUMonitoring/images/fondoMainOptions.png 304
    15:03:01 127.0.0.1 GET /ALUMonitoring/images/Reglas.png 304
    15:03:02 127.0.0.1 GET /ALUMonitoring/WelcomeAdmin.aspx 200
    15:03:02 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304
    15:03:02 127.0.0.1 GET /ALUMonitoring/images/fondo_01_819x590.png 304
    15:03:02 127.0.0.1 GET /ALUMonitoring/images/sombra_01.png 304
    15:03:02 127.0.0.1 GET /ALUMonitoring/images/fur_01_tr.png 304
    15:03:02 127.0.0.1 GET /ALUMonitoring/images/fur_02_tr.png 304
    15:03:02 127.0.0.1 GET /ALUMonitoring/images/fur_03_tr.png 304
    15:03:02 127.0.0.1 GET /ALUMonitoring/images/borderbottom.gif 304
    15:03:02 127.0.0.1 GET /ALUMonitoring/images/line510.gif 304
    15:03:47 127.0.0.1 GET /ALUMonitoring/DesktopOpFrame.aspx 200
    15:03:47 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304
    15:03:48 127.0.0.1 GET /ALUMonitoring/DesktopOp.aspx 200
    15:03:48 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304
    15:03:48 127.0.0.1 GET /ALUMonitoring/images/fondoMainOptions.png 304
    15:03:48 127.0.0.1 GET /ALUMonitoring/images/Experiencia-de-usuario.png 304
    15:03:48 127.0.0.1 GET /ALUMonitoring/images/actualizar.gif 304
    15:03:48 127.0.0.1 GET /ALUMonitoring/images/Seleccion-de-reglas.png 304
    15:03:48 127.0.0.1 GET /ALUMonitoring/images/Video-wall-NOC.png 304
    15:03:48 127.0.0.1 GET /ALUMonitoring/WelcomeDesk.aspx 200
    15:03:48 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304
    15:03:48 127.0.0.1 GET /ALUMonitoring/images/fondo_01_819x590.png 304
    15:03:48 127.0.0.1 GET /ALUMonitoring/images/sombra_01.png 304
    15:03:48 127.0.0.1 GET /ALUMonitoring/images/fur_01_tr.png 304
    15:03:48 127.0.0.1 GET /ALUMonitoring/images/fur_03_tr.png 304
    15:03:48 127.0.0.1 GET /ALUMonitoring/images/fur_02_tr.png 304
    15:03:48 127.0.0.1 GET /ALUMonitoring/images/line510.gif 304
    15:03:48 127.0.0.1 GET /ALUMonitoring/images/borderbottom.gif 304

    The first request to load the page is at 15:03:01, a bunch of files is transferred, but then there is a gap and the rest of files are only transferred at 15:03:47.

    Further accesses to the web application are fast, I assume because all those images are already cached in memory by IIS.

    I wonder if we could pre-cache or something those files, in order to have a fast access even the first time.

    If not, whenever we change an ASPX o DLL file in the web site, next access to it experiences this problem.

    Our server is running Windows 2003 Server, with IIS 6.0 and .NET Framework 2.0.

    Thanks in advance. 

  • 09-10-2008, 5:36 AM In reply to

    Re: Pre-caching images

    Hi,

    If you modify a DLL or config file you will cause your appdomain to be recycled - this is expected behaviour. If you make a change to your application you would presumably want the latest version of your application to be served to your clients.

    In your log file extract there is a considerable gap between these two requests :

    15:03:02 127.0.0.1 GET /ALUMonitoring/images/line510.gif 304
    15:03:47 127.0.0.1 GET /ALUMonitoring/DesktopOpFrame.aspx 200

    How long did the request for the file 'DesktopOpFrame.aspx' take to complete ? You might need to enable the time-taken field in your log files to get this information as this is not enabled by default, which is a bad default IMHO, but that's another story.

    Regards, 

    Paul Lynch | www.iisadmin.co.uk
  • 09-10-2008, 6:53 AM In reply to

    • perevera
    • Not Ranked
    • Joined on 09-10-2008, 3:29 AM
    • Posts 5

    Re: Pre-caching images

    My fault: I mixed up two accesses to two different applications in the previous traces.

    I have enabled the time-taken field and this is the result:

    10:42:40 127.0.0.1 GET /ALUMonitoring/MonitoringAdminFrame.aspx 200 42468
    10:42:40 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304 0
    10:42:40 127.0.0.1 GET /ALUMonitoring/MonitoringAdmin.aspx 200 94
    10:42:40 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304 0
    10:42:40 127.0.0.1 GET /ALUMonitoring/images/Configuracion.png 304 0
    10:42:40 127.0.0.1 GET /ALUMonitoring/images/Recursos.png 304 0
    10:42:40 127.0.0.1 GET /ALUMonitoring/images/Reglas.png 304 0
    10:42:40 127.0.0.1 GET /ALUMonitoring/images/fondoMainOptions.png 304 0
    10:42:40 127.0.0.1 GET /ALUMonitoring/WelcomeAdmin.aspx 200 547
    10:42:40 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304 0
    10:42:40 127.0.0.1 GET /ALUMonitoring/images/fondo_01_819x590.png 304 0
    10:42:40 127.0.0.1 GET /ALUMonitoring/images/sombra_01.png 304 0
    10:42:40 127.0.0.1 GET /ALUMonitoring/images/fur_01_tr.png 304 16
    10:42:40 127.0.0.1 GET /ALUMonitoring/images/fur_02_tr.png 304 0
    10:42:40 127.0.0.1 GET /ALUMonitoring/images/fur_03_tr.png 304 0
    10:42:40 127.0.0.1 GET /ALUMonitoring/images/line510.gif 304 0
    10:42:40 127.0.0.1 GET /ALUMonitoring/images/borderbottom.gif 304 0

    So, must consuming time is the load of /ALUMonitoring/MonitoringAdminFrame.aspx

    When data is in cache then I get something like this:

    10:43:49 127.0.0.1 GET /ALUMonitoring/MonitoringAdminFrame.aspx 200 18281
    10:43:49 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304 0
    10:43:49 127.0.0.1 GET /ALUMonitoring/MonitoringAdmin.aspx 200 78
    10:43:49 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304 0
    10:43:49 127.0.0.1 GET /ALUMonitoring/images/Recursos.png 304 0
    10:43:49 127.0.0.1 GET /ALUMonitoring/images/Configuracion.png 304 0
    10:43:49 127.0.0.1 GET /ALUMonitoring/images/Reglas.png 304 0
    10:43:49 127.0.0.1 GET /ALUMonitoring/images/fondoMainOptions.png 304 15
    10:43:51 127.0.0.1 GET /ALUMonitoring/WelcomeAdmin.aspx 200 1672
    10:43:51 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304 0
    10:43:51 127.0.0.1 GET /ALUMonitoring/images/fondo_01_819x590.png 304 0
    10:43:51 127.0.0.1 GET /ALUMonitoring/images/sombra_01.png 304 0
    10:43:51 127.0.0.1 GET /ALUMonitoring/images/fur_01_tr.png 304 0
    10:43:51 127.0.0.1 GET /ALUMonitoring/images/fur_02_tr.png 304 0
    10:43:51 127.0.0.1 GET /ALUMonitoring/images/fur_03_tr.png 304 0
    10:43:51 127.0.0.1 GET /ALUMonitoring/images/line510.gif 304 0
    10:43:51 127.0.0.1 GET /ALUMonitoring/images/borderbottom.gif 304 0

    I.e., it looks like it takes less than half the time of the first access.

    Is it possible to speed up the first access?
     

  • 09-10-2008, 8:10 AM In reply to

    Re: Pre-caching images

    Hi,

    So, looking through your log file you can see that it's taking just over 42 seconds for the 'MonitoringAdminFrame.aspx' page to do whatever it is that it does when it gets called for the first time and then around 18 seconds for each subsequent request.

    Most of the images being requested are already in the client's cache so its difficult to know how long it would take IIS to serve them otherwise.

    However, it's pretty clear that the problem is not the one you originally believed it to be (i.e. needing to cache images to speed things up) - your performance issue appears to be related to the behaviour of your .Net application code.

    You would need to speak to the developer of that code to find out how it can be optimised I'm afraid.

    Regards, 

    Paul Lynch | www.iisadmin.co.uk
  • 09-10-2008, 8:23 AM In reply to

    • perevera
    • Not Ranked
    • Joined on 09-10-2008, 3:29 AM
    • Posts 5

    Re: Pre-caching images

    Thanks a lot, Paul, we will research in this direction... 

  • 09-15-2008, 7:28 AM In reply to

    • perevera
    • Not Ranked
    • Joined on 09-10-2008, 3:29 AM
    • Posts 5

    Re: Pre-caching images

    Hi, Paul.

    Still, I would like to know if there is a way of pre-caching a bunch of images in IIS 6.0.

    I really believe this is the actual problem, see how some accesses are really slow compared to others:

     
    11:08:08 127.0.0.1 GET /ALUMonitoring/MonitoringAdminFrame.aspx 200 46
    11:15:33 127.0.0.1 GET /ALUMonitoring/MonitoringAdminFrame.aspx 200 17985
    11:15:38 127.0.0.1 GET /ALUMonitoring/MonitoringAdminFrame.aspx 200 15078
    11:15:55 127.0.0.1 GET /ALUMonitoring/MonitoringAdminFrame.aspx 200 15

    (I extracted from the log file only those lines containing the access to that page).

    Thanks for your help.

  • 09-15-2008, 9:12 AM In reply to

    Re: Pre-caching images

    Hi,

    File caching in IIS 6.0 is explained here :

    Improving Scalability by Optimizing IIS 6.0 Caches (IIS 6.0)

    But I don't think this is the root cause of your application's performance issues - IIS isn't waiting around for images to be served, its waiting for your  MonitoringAdminFrame.aspx page to complete whatever it is it's doing.

    Regards,
     

     

    Paul Lynch | www.iisadmin.co.uk
  • 09-15-2008, 11:02 AM In reply to

    • perevera
    • Not Ranked
    • Joined on 09-10-2008, 3:29 AM
    • Posts 5

    Re: Pre-caching images

     

    Ok, let’s put it in a different way.

     

    Now, we will look at another application, this is called DesktopOpFrame.aspx and its structure is very similar to that of MonitoringAdminFrame.aspx.

     

    See here the relevant traces from first and two subsequent accesses:

     

    1st

    ==

    13:52:46 127.0.0.1 GET /ALUMonitoring/DesktopOpFrame.aspx 200 47843

    13:52:46 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304 0

    13:52:46 127.0.0.1 GET /ALUMonitoring/DesktopOp.aspx 200 78

    13:52:46 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304 0

    13:52:46 127.0.0.1 GET /ALUMonitoring/images/fondoMainOptions.png 304 0

    13:52:46 127.0.0.1 GET /ALUMonitoring/images/Experiencia-de-usuario.png 304 0

    13:52:46 127.0.0.1 GET /ALUMonitoring/images/actualizar.gif 304 0

    13:52:46 127.0.0.1 GET /ALUMonitoring/images/Seleccion-de-reglas.png 304 0

    13:52:46 127.0.0.1 GET /ALUMonitoring/images/Video-wall-NOC.png 304 0

    13:52:47 127.0.0.1 GET /ALUMonitoring/WelcomeDesk.aspx 200 781

    13:52:47 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304 0

    13:52:47 127.0.0.1 GET /ALUMonitoring/images/fondo_01_819x590.png 304 0

    13:52:47 127.0.0.1 GET /ALUMonitoring/images/sombra_01.png 304 0

    13:52:47 127.0.0.1 GET /ALUMonitoring/images/fur_01_tr.png 304 0

    13:52:47 127.0.0.1 GET /ALUMonitoring/images/fur_02_tr.png 304 0

    13:52:47 127.0.0.1 GET /ALUMonitoring/images/fur_03_tr.png 304 0

    13:52:47 127.0.0.1 GET /ALUMonitoring/images/line510.gif 304 0

    13:52:47 127.0.0.1 GET /ALUMonitoring/images/borderbottom.gif 304 0

     

    2nd

    ==

    13:53:13 127.0.0.1 GET /ALUMonitoring/DesktopOpFrame.aspx 200 62

    13:53:13 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304 0

    13:53:13 127.0.0.1 GET /ALUMonitoring/DesktopOp.aspx 200 31

    13:53:13 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304 0

    13:53:13 127.0.0.1 GET /ALUMonitoring/images/Experiencia-de-usuario.png 304 0

    13:53:13 127.0.0.1 GET /ALUMonitoring/images/fondoMainOptions.png 304 0

    13:53:13 127.0.0.1 GET /ALUMonitoring/images/actualizar.gif 304 0

    13:53:13 127.0.0.1 GET /ALUMonitoring/images/Seleccion-de-reglas.png 304 0

    13:53:13 127.0.0.1 GET /ALUMonitoring/images/Video-wall-NOC.png 304 0

    13:53:13 127.0.0.1 GET /ALUMonitoring/WelcomeDesk.aspx 200 515

    13:53:13 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304 0

    13:53:13 127.0.0.1 GET /ALUMonitoring/images/fondo_01_819x590.png 304 0

    13:53:13 127.0.0.1 GET /ALUMonitoring/images/fur_02_tr.png 304 0

    13:53:13 127.0.0.1 GET /ALUMonitoring/images/fur_01_tr.png 304 0

    13:53:13 127.0.0.1 GET /ALUMonitoring/images/fur_03_tr.png 304 0

    13:53:13 127.0.0.1 GET /ALUMonitoring/images/sombra_01.png 304 0

    13:53:13 127.0.0.1 GET /ALUMonitoring/images/line510.gif 304 0

    13:53:13 127.0.0.1 GET /ALUMonitoring/images/borderbottom.gif 304 0

     

    3rd

    ===

    13:54:39 127.0.0.1 GET /ALUMonitoring/DesktopOpFrame.aspx 200 31

    13:54:39 127.0.0.1 GET /ALUMonitoring/DesktopOp.aspx 200 31

    13:54:39 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 200 46

    13:54:39 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304 0

    13:54:39 127.0.0.1 GET /ALUMonitoring/WelcomeDesk.aspx 200 47

    13:54:39 127.0.0.1 GET /ALUMonitoring/images/Experiencia-de-usuario.png 200 15

    13:54:39 127.0.0.1 GET /ALUMonitoring/images/actualizar.gif 200 32

    13:54:39 127.0.0.1 GET /ALUMonitoring/images/fondoMainOptions.png 200 15

    13:54:39 127.0.0.1 GET /ALUMonitoring/images/Seleccion-de-reglas.png 200 16

    13:54:39 127.0.0.1 GET /ALUMonitoring/css/Aplication.css 304 0

    13:54:39 127.0.0.1 GET /ALUMonitoring/images/Video-wall-NOC.png 200 31

    13:54:39 127.0.0.1 GET /ALUMonitoring/WebResource.axd 200 16

    13:54:40 127.0.0.1 GET /ALUMonitoring/images/sombra_01.png 200 0

    13:54:40 127.0.0.1 GET /ALUMonitoring/images/fondo_01_819x590.png 200 47

    13:54:40 127.0.0.1 GET /ALUMonitoring/images/fur_02_tr.png 200 0

    13:54:40 127.0.0.1 GET /ALUMonitoring/images/fur_01_tr.png 200 15

    13:54:40 127.0.0.1 GET /ALUMonitoring/images/line510.gif 200 16

    13:54:40 127.0.0.1 GET /ALUMonitoring/images/borderbottom.gif 200 31

    13:54:40 127.0.0.1 GET /ALUMonitoring/images/fur_03_tr.png 200 79

     

    Again, we see how the first GET /ALUMonitoring/DesktopOpFrame.aspx takes more than 45 seconds to be loaded, while further accesses take less than 100 milliseconds.

     

    The corresponding .vb file contains code for initializing files and variables on Page_Load().  Here (and all throughout the ASPX page) we execute code from different files contained in the app_code.dll library.

     

    Later on, it will load the two page frames that compose the web, DesktopOp.aspx and WelcomeDesk.aspx, with all the menus and graphics.

     

    My guess now is that the cost effective part is when loading for the first time the app_code.dll library, and for this we should use some ASP.NET caching technique.

     

    Do you believe we are now on the right track?



     

Page 1 of 1 (8 items)
Microsoft Communities