cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Goers (JIRA)" <j...@apache.org>
Subject [jira] Updated: (COCOON-1391) [PATCH] Popular website with XSP homepage won't come up
Date Tue, 25 Oct 2005 00:52:56 GMT
     [ http://issues.apache.org/jira/browse/COCOON-1391?page=all ]

Ralph Goers updated COCOON-1391:
--------------------------------

    Bugzilla Id:   (was: 32935)
      Component: Blocks: XSP
                     (was: Blocks: (Undefined))
    Description: 
Whilst the cache of compiled XSPs is empty, each thread entering 
a.o.c.components.language.generator.ProgramGeneratorImpl.load queues for the 
lock on self and before compiling the XSP.

If during startup requests for an XSP arrive faster than the time it takes to 
compile the XSP, the server will be on its knees recompiling the same XSP over 
and over again.  Therefore a popular website with an XSP homepage will have a 
hard time to come up.

PATCH
=====
After acquiring the lock, check again the cache:

--- ProgramGeneratorImpl.java   7 Jul 2003 14:32:15 -0000       1.1.1.3
+++ ProgramGeneratorImpl.java   4 Jan 2005 11:27:14 -0000
@@ -290,21 +290,31 @@
             }
 
             if (programInstance == null) {
-                // no instance found
-                if (getLogger().isDebugEnabled()) {
-                    getLogger().debug("Creating new serverpage for [" + id 
+ "]");
-                }
                 synchronized (this) {
-                    generateSourcecode(source,
-                                       normalizedName,
-                                       markupLanguage,
-                                       programmingLanguage);
-
-                    programInstance = loadProgram(newManager,
-                                                  normalizedName,
-                                                  markupLanguage,
-                                                  programmingLanguage);
-                }
+                   // Attempt again to load program object from cache.
+                   // This avoids that simultaneous requests recompile
+                   // the same XSP over and over again.
+                   try {
+                       programInstance = (CompiledComponent) this.cache.select
(normalizedName);
+                       if (getLogger().isDebugEnabled()) {
+                           getLogger().debug("The serverpage [" + id + "] was 
now in the cache");
+                       }
+                   } catch (ComponentException e) {
+                       // no instance found
+                       if (getLogger().isDebugEnabled()) {
+                           getLogger().debug("Creating new serverpage for [" + 
id + "]");
+                       }
+                       generateSourcecode(source,
+                                          normalizedName,
+                                          markupLanguage,
+                                          programmingLanguage);
+
+                       programInstance = loadProgram(newManager,
+                                                     normalizedName,
+                                                     markupLanguage,
+                                                     programmingLanguage);
+                   }
+               }
             } else {
                 // found an instance
                 if (this.autoReload) {

  was:
Whilst the cache of compiled XSPs is empty, each thread entering 
a.o.c.components.language.generator.ProgramGeneratorImpl.load queues for the 
lock on self and before compiling the XSP.

If during startup requests for an XSP arrive faster than the time it takes to 
compile the XSP, the server will be on its knees recompiling the same XSP over 
and over again.  Therefore a popular website with an XSP homepage will have a 
hard time to come up.

PATCH
=====
After acquiring the lock, check again the cache:

--- ProgramGeneratorImpl.java   7 Jul 2003 14:32:15 -0000       1.1.1.3
+++ ProgramGeneratorImpl.java   4 Jan 2005 11:27:14 -0000
@@ -290,21 +290,31 @@
             }
 
             if (programInstance == null) {
-                // no instance found
-                if (getLogger().isDebugEnabled()) {
-                    getLogger().debug("Creating new serverpage for [" + id 
+ "]");
-                }
                 synchronized (this) {
-                    generateSourcecode(source,
-                                       normalizedName,
-                                       markupLanguage,
-                                       programmingLanguage);
-
-                    programInstance = loadProgram(newManager,
-                                                  normalizedName,
-                                                  markupLanguage,
-                                                  programmingLanguage);
-                }
+                   // Attempt again to load program object from cache.
+                   // This avoids that simultaneous requests recompile
+                   // the same XSP over and over again.
+                   try {
+                       programInstance = (CompiledComponent) this.cache.select
(normalizedName);
+                       if (getLogger().isDebugEnabled()) {
+                           getLogger().debug("The serverpage [" + id + "] was 
now in the cache");
+                       }
+                   } catch (ComponentException e) {
+                       // no instance found
+                       if (getLogger().isDebugEnabled()) {
+                           getLogger().debug("Creating new serverpage for [" + 
id + "]");
+                       }
+                       generateSourcecode(source,
+                                          normalizedName,
+                                          markupLanguage,
+                                          programmingLanguage);
+
+                       programInstance = loadProgram(newManager,
+                                                     normalizedName,
+                                                     markupLanguage,
+                                                     programmingLanguage);
+                   }
+               }
             } else {
                 // found an instance
                 if (this.autoReload) {


> [PATCH] Popular website with XSP homepage won't come up
> -------------------------------------------------------
>
>          Key: COCOON-1391
>          URL: http://issues.apache.org/jira/browse/COCOON-1391
>      Project: Cocoon
>         Type: Bug
>   Components: Blocks: XSP
>     Versions: 2.1.8-dev (Current SVN)
>  Environment: Operating System: All
> Platform: All
>     Reporter: Alfred Nathaniel
>     Assignee: Cocoon Developers Team

>
> Whilst the cache of compiled XSPs is empty, each thread entering 
> a.o.c.components.language.generator.ProgramGeneratorImpl.load queues for the 
> lock on self and before compiling the XSP.
> If during startup requests for an XSP arrive faster than the time it takes to 
> compile the XSP, the server will be on its knees recompiling the same XSP over 
> and over again.  Therefore a popular website with an XSP homepage will have a 
> hard time to come up.
> PATCH
> =====
> After acquiring the lock, check again the cache:
> --- ProgramGeneratorImpl.java   7 Jul 2003 14:32:15 -0000       1.1.1.3
> +++ ProgramGeneratorImpl.java   4 Jan 2005 11:27:14 -0000
> @@ -290,21 +290,31 @@
>              }
>  
>              if (programInstance == null) {
> -                // no instance found
> -                if (getLogger().isDebugEnabled()) {
> -                    getLogger().debug("Creating new serverpage for [" + id 
> + "]");
> -                }
>                  synchronized (this) {
> -                    generateSourcecode(source,
> -                                       normalizedName,
> -                                       markupLanguage,
> -                                       programmingLanguage);
> -
> -                    programInstance = loadProgram(newManager,
> -                                                  normalizedName,
> -                                                  markupLanguage,
> -                                                  programmingLanguage);
> -                }
> +                   // Attempt again to load program object from cache.
> +                   // This avoids that simultaneous requests recompile
> +                   // the same XSP over and over again.
> +                   try {
> +                       programInstance = (CompiledComponent) this.cache.select
> (normalizedName);
> +                       if (getLogger().isDebugEnabled()) {
> +                           getLogger().debug("The serverpage [" + id + "] was 
> now in the cache");
> +                       }
> +                   } catch (ComponentException e) {
> +                       // no instance found
> +                       if (getLogger().isDebugEnabled()) {
> +                           getLogger().debug("Creating new serverpage for [" + 
> id + "]");
> +                       }
> +                       generateSourcecode(source,
> +                                          normalizedName,
> +                                          markupLanguage,
> +                                          programmingLanguage);
> +
> +                       programInstance = loadProgram(newManager,
> +                                                     normalizedName,
> +                                                     markupLanguage,
> +                                                     programmingLanguage);
> +                   }
> +               }
>              } else {
>                  // found an instance
>                  if (this.autoReload) {

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message