You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Henning Schmiedehausen (JIRA)" <ji...@apache.org> on 2006/11/04 20:18:18 UTC

[jira] Resolved: (VELOCITY-24) calls to local macros not always made when template caching is off

     [ http://issues.apache.org/jira/browse/VELOCITY-24?page=all ]

Henning Schmiedehausen resolved VELOCITY-24.
--------------------------------------------

    Resolution: Fixed

getResource() must be synchronized. Yes, that sucks for applications that hammer on that and have caching off. Here are some numbers (running on my shiny new Core 2 Duo box, Tomcat and VelocityViewServlet running under the debugger)

ab -c 5 -n 1000 http://localhost:8080/testbed/templates/issues/velocity-24.vm

unsynced, caching off:

Document Path:          /testbed/templates/issues/velocity-24.vm
Document Length:        663 bytes

Concurrency Level:      5
Time taken for tests:   4.193717 seconds
Complete requests:      1000
Failed requests:        760               <-------------------------- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   (Connect: 0, Length: 760, Exceptions: 0)
Write errors:           0
Total transferred:      595970 bytes
HTML transferred:       449860 bytes
Requests per second:    238.45 [#/sec] (mean)
Time per request:       20.969 [ms] (mean)
Time per request:       4.194 [ms] (mean, across all concurrent requests)
Transfer rate:          138.78 [Kbytes/sec] received

unsynced, cache on:

Document Path:          /testbed/templates/issues/velocity-24.vm
Document Length:        663 bytes

Concurrency Level:      5
Time taken for tests:   0.479525 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      809809 bytes
HTML transferred:       663663 bytes
Requests per second:    2085.40 [#/sec] (mean)
Time per request:       2.398 [ms] (mean)
Time per request:       0.480 [ms] (mean, across all concurrent requests)
Transfer rate:          1647.46 [Kbytes/sec] received

synced, cache off:

Document Path:          /testbed/templates/issues/velocity-24.vm
Document Length:        663 bytes

Concurrency Level:      5
Time taken for tests:   11.92560 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      809000 bytes
HTML transferred:       663000 bytes
Requests per second:    90.15 [#/sec] (mean)
Time per request:       55.463 [ms] (mean)
Time per request:       11.093 [ms] (mean, across all concurrent requests)
Transfer rate:          71.22 [Kbytes/sec] received

synced, cache on

Document Path:          /testbed/templates/issues/velocity-24.vm
Document Length:        663 bytes

Concurrency Level:      5
Time taken for tests:   0.333444 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      810618 bytes
HTML transferred:       664326 bytes
Requests per second:    2999.00 [#/sec] (mean)
Time per request:       1.667 [ms] (mean)
Time per request:       0.333 [ms] (mean, across all concurrent requests)
Transfer rate:          2372.21 [Kbytes/sec] received

The response time for cache on (which should be the normal production mode) is about the same level for synced and unsynced. But without cache, syncing makes the difference between "fast but wrong" and "slower but correct". I personally opt for the latter.

> calls to local macros not always made when template caching is off
> ------------------------------------------------------------------
>
>                 Key: VELOCITY-24
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-24
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.5 beta1
>         Environment: Operating System: other
> Platform: Other
>            Reporter: peterwlynch
>         Assigned To: Henning Schmiedehausen
>            Priority: Blocker
>             Fix For: 1.5
>
>
> In the latest nightly build Oct 28, 2001 and also in velocity 1.2 rc2 i noticed 
> the following problem with autoreloading macros.
> Made a simple html page. added a simple one line macro that accepted one param, 
> a letter
> something like....
> ## local macro, not global
> #macro(letter $char)
>     This is the letter $char
> #end
> #letter("A")
> #letter("B")
> #letter("C")
> etc.... to Z
> ------
> The html page would be loaded in response to a form being submitted. If I 
> clicked on the submit button five times, quickly ( five separate submits), most 
> times the final response would out put something like...
> ----
> This is the letter A
> This is the letter B
> This is the letter C
> This is the letter D
> This is the letter E
> #letter    #letter    #letter 
> #letter ......
> This is the letter Z
> As you can see, some macro calls did not get parsed.
> We were just happening to use velocity through turbine, but I don't think that 
> affects the bug. Besides, the bug went away when the autoreload was false.
> Once scarab's runbox is back up, might be interesting to test this out on their 
> macros too for comparison, although I don't see that they have any local macros.

-- 
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org