You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2012/04/27 02:59:15 UTC

Configuring number of parsers and buffer sizes

All,

I've been looking at the docs for both Velocity Tools and Velocity
itself and I can't seem to find out what the properties are for
controlling the number of template parsers to create and how big their
buffer sizes are.

I've been doing some memory profiling of my webapp and it looks like
Velocity is keeping some rather large (and empty -- probably because
they haven't yet been used) buffers for parsing.

I can see a bunch (76) of int[4096] arrays within VelocityCharStream
(the class member is 'bufline'), and I can also see buried in
VelocityCharStream which uses an InputStreamReader ('inputStream') a
byte[8192] which appears to exist 48 separate times.

So, the total "wasted" space due to these two arrays (duplicated a bunch
of times) is, on the face of it, small: it's like 1-2MiB. On the other
hand, if I don't need all that buffer space, I'd like to remove it.

So, first: how can I configure the number of parsers and possibly the
buffer sizes used by them?

Second: is VelocityCharStream essentially double-buffering since the
InputStreamReader seems to have a large buffer inside it and also
VelocityCharStream has its own buffer?

Thanks,
-chris


Re: Configuring number of parsers and buffer sizes

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Nathan,

On 4/26/12 11:58 PM, Nathan Bubna wrote:
> parser.pool.size

I'll check that out.

> is this in 1.7?

Yes. Velocity 1.7 and Velocity Tools 2.0.0 (with a few unrelated patches).

> i thought we trimmed a lot of the excess between 1.5
> and 1.6, but if we can trim more, that'd be swell.

I'll see if I can post a jhat file or something like that and you can
check it out.

Thanks,
-chris


Re: Configuring number of parsers and buffer sizes

Posted by Nathan Bubna <nb...@gmail.com>.
parser.pool.size

is this in 1.7?  i thought we trimmed a lot of the excess between 1.5
and 1.6, but if we can trim more, that'd be swell.

On Thu, Apr 26, 2012 at 5:59 PM, Christopher Schultz
<ch...@christopherschultz.net> wrote:
> All,
>
> I've been looking at the docs for both Velocity Tools and Velocity
> itself and I can't seem to find out what the properties are for
> controlling the number of template parsers to create and how big their
> buffer sizes are.
>
> I've been doing some memory profiling of my webapp and it looks like
> Velocity is keeping some rather large (and empty -- probably because
> they haven't yet been used) buffers for parsing.
>
> I can see a bunch (76) of int[4096] arrays within VelocityCharStream
> (the class member is 'bufline'), and I can also see buried in
> VelocityCharStream which uses an InputStreamReader ('inputStream') a
> byte[8192] which appears to exist 48 separate times.
>
> So, the total "wasted" space due to these two arrays (duplicated a bunch
> of times) is, on the face of it, small: it's like 1-2MiB. On the other
> hand, if I don't need all that buffer space, I'd like to remove it.
>
> So, first: how can I configure the number of parsers and possibly the
> buffer sizes used by them?
>
> Second: is VelocityCharStream essentially double-buffering since the
> InputStreamReader seems to have a large buffer inside it and also
> VelocityCharStream has its own buffer?
>
> Thanks,
> -chris
>

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


Re: Configuring number of parsers and buffer sizes

Posted by Christopher Schultz <ch...@christopherschultz.net>.
All,

On 4/26/12 8:59 PM, Christopher Schultz wrote:
> I can see a bunch (76) of int[4096] arrays within VelocityCharStream
> (the class member is 'bufline'), and I can also see buried in
> VelocityCharStream which uses an InputStreamReader ('inputStream') a
> byte[8192] which appears to exist 48 separate times.

Plus, VelocityCharStream also has a "buffer" attribute which is yet
another char[4096].

-chris