You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Tim Ellison <t....@gmail.com> on 2008/12/10 11:50:14 UTC
[vm] Implement on-demand class library parsing to avoid unnecessary
jar/zip parsing during startup (HARMONY-6039)
This is cool.
Wenlong Li (JIRA) wrote:
> During VM creation, Harmony will parse all class libraried defined in
> bootclasspath.properties under jre/lib/boot directory. However, not
> all class libraries are accessed during startup. That means, it is
> not necessary to open and resolve all these class libraries.
Agreed.
> In this patch, I implement the on-demand jar parsing. I leverage the
> class library info defined in the manifest file of each module. For a
> request class, if it is not available in existing class table, I then
> parse its class library info, and check which module contains this
> requested class. That is, I parse the class library on demand.
Its good to see the manifest information being used at runtime.
So as I understand it, you are not looking to provide any isolation
between modules, just using the metadata to direct the search path.
> Using on-demand class library parsing, I can reduce the VM creation
> time from 20+ seconds to 3 seconds.
Wow, that's remarkable. Is ZIP file directory performance really that bad?
I'm assuming that it is multiple VM creations (it doesn't take 20s to
invoke the VM usually!) And that is still opening and reading the
manifest from each JAR?
I assume we could improve that by consolidating that metadata into a
file with faster access.
> I enable this feature into reading boot class path option, and it can
> be disabled by using -Xbootclasspath option.
Regards,
Tim
Re: [vm] Implement on-demand class library parsing to avoid unnecessary jar/zip parsing during startup (HARMONY-6039)
Posted by Wenlong Li <we...@gmail.com>.
Tim,
I didn't spend more efforts to collect trace. Based on my experiment,
reducing the number of loaded byte can help performance. Reducing the
loading of zip can also help performance. But I don't collect exact
performance data for each. Also adjusting the layout of zip in
consecutive disk can also help performance. As I have reduced the VM
creation time from 20+ seconds to 3 seconds on my windows machine, I
suppose there would be small benefit when taking other approaches. But
I believe they would help performance as you pointed out.
Thx,
Wenlong
On Sat, Dec 13, 2008 at 12:07 AM, Tim Ellison <t....@gmail.com> wrote:
> Wenlong Li wrote:
>> The performance of on-demand library parsing is mostly from I/O (seek
>> the jar, open the jar, read content for each class in the jar, etc).
>> When disk cache is warm-up, the I/O impact is small, and then we see
>> small performance improvement.
>
> Ok, so that says that better indexing of the bytes we need to load on
> start-up won't necessarily help. We need to reduce the number of bytes
> we load, or optimize the layout to help the loading speed up, right?
>
> Or do you mean the time is spent loading the ZIP directories (rather
> than class file bytes)?
>
> Do you have some trace that shows what's happening?
>
>> You see the bootclasspath property is pre-defined in
>> working_classlib\depends\files, so I pre-define another property file
>> which saves the class library info for each package. I assume the
>> library in each module will not change over time, just like the
>> bootclasspath property file. Of course, when new module is added, we
>> need update these properties. Question is how Harmony revises the
>> bootclasspath property now?
>
> It is defined by parsing the bootclass.properties file.
>
>> I will think about how to automatically extract the package info from
>> manifest of each module, and save them in my defined property file at
>> compiling time.
>>
>> Suggestion and comments are welcome and appreciated. :)
>
> Don't bother yet :-) Seriously.
>
> If you say that the time is taken to seek and read the bytes for the ZIP
> file directory...
> ...then why stop at building the index to show where packages are?
> ...why not build a full class level index?
>
> If you are saying that the time is spent loading the actual class files
> from disk, and not parsing the ZIP directory entries to search for the
> location of the bytes then this won't help and we need to layout the
> bytes in a way that optimizes for start-up reading - or allow overlapped
> reading and defer to the OS - or ?
>
> Regards,
> Tim
>
>
Re: [vm] Implement on-demand class library parsing to avoid unnecessary
jar/zip parsing during startup (HARMONY-6039)
Posted by Tim Ellison <t....@gmail.com>.
Wenlong Li wrote:
> The performance of on-demand library parsing is mostly from I/O (seek
> the jar, open the jar, read content for each class in the jar, etc).
> When disk cache is warm-up, the I/O impact is small, and then we see
> small performance improvement.
Ok, so that says that better indexing of the bytes we need to load on
start-up won't necessarily help. We need to reduce the number of bytes
we load, or optimize the layout to help the loading speed up, right?
Or do you mean the time is spent loading the ZIP directories (rather
than class file bytes)?
Do you have some trace that shows what's happening?
> You see the bootclasspath property is pre-defined in
> working_classlib\depends\files, so I pre-define another property file
> which saves the class library info for each package. I assume the
> library in each module will not change over time, just like the
> bootclasspath property file. Of course, when new module is added, we
> need update these properties. Question is how Harmony revises the
> bootclasspath property now?
It is defined by parsing the bootclass.properties file.
> I will think about how to automatically extract the package info from
> manifest of each module, and save them in my defined property file at
> compiling time.
>
> Suggestion and comments are welcome and appreciated. :)
Don't bother yet :-) Seriously.
If you say that the time is taken to seek and read the bytes for the ZIP
file directory...
...then why stop at building the index to show where packages are?
...why not build a full class level index?
If you are saying that the time is spent loading the actual class files
from disk, and not parsing the ZIP directory entries to search for the
location of the bytes then this won't help and we need to layout the
bytes in a way that optimizes for start-up reading - or allow overlapped
reading and defer to the OS - or ?
Regards,
Tim
Re: [vm] Implement on-demand class library parsing to avoid unnecessary jar/zip parsing during startup (HARMONY-6039)
Posted by Wenlong Li <we...@gmail.com>.
all,
Thx for your kind suggestion.
The performance of on-demand library parsing is mostly from I/O (seek
the jar, open the jar, read content for each class in the jar, etc).
When disk cache is warm-up, the I/O impact is small, and then we see
small performance improvement.
You see the bootclasspath property is pre-defined in
working_classlib\depends\files, so I pre-define another property file
which saves the class library info for each package. I assume the
library in each module will not change over time, just like the
bootclasspath property file. Of course, when new module is added, we
need update these properties. Question is how Harmony revises the
bootclasspath property now?
I will think about how to automatically extract the package info from
manifest of each module, and save them in my defined property file at
compiling time.
Suggestion and comments are welcome and appreciated. :)
On Thu, Dec 11, 2008 at 10:12 AM, Nathan Beyer <nd...@apache.org> wrote:
> I like the proposal, but I'd like to see an addition that either
> negates the duplication of manifest information or automates the
> generation of it. The later may be easiest - add a bit to the build
> that reads the manifests and generates the file.
>
> -Nathan
>
> On Wed, Dec 10, 2008 at 8:22 AM, Xiao-Feng Li <xi...@gmail.com> wrote:
>> On Wed, Dec 10, 2008 at 10:07 PM, Tim Ellison <t....@gmail.com> wrote:
>>> Xiao-Feng Li wrote:
>>>> On Wed, Dec 10, 2008 at 9:11 PM, Tim Ellison <t....@gmail.com> wrote:
>>>>> So my question is where is the time being saved using this technique?
>>>>>
>>>>> Is it the number of files we touch? e.g. disc seek time, or is it
>>>>> searching through the ZIP directories looking for class files e.g. poor
>>>>> ZIP performance for our usage, or ...
>>>>>
>>>>> Given that the cold start times improve by 85% (20s down to 3s), and
>>>>> warm start improves by ~18% (170ms down to 140ms), it is most likely the
>>>>> 'getting the bits off disc' part. Does that sound right? Can we
>>>>> measure it?
>>>>
>>>> I am also wondering about it. There are two ways to save time: one is
>>>> to reduce the number of JARs by repackaging all the classes; the other
>>>> is to reduce the number of JARs loaded. As I know, the first approach
>>>> helps little. That probably means the disk seeking time is the major
>>>> contributor of startup time.
>>>>
>>>> If this hypothesis is correct, then to delay the loading of JARs can
>>>> benefit even if all the JARs are needed in the end by an application.
>>>> The reason is the IO time can be overlapped with the computation time.
>>>
>>> Yes, especially if we have the metadata that tells us where the classes
>>> are stored. We can queue requests to load multiple class files
>>> asynchronously in the file system.
>>>
>>>> Well, this solution might not really help, if an application (or
>>>> benchmark) only measures the period after VM is launched. (This is
>>>> probably true since a Java timer can be triggered only after VM is
>>>> created, unless the benchmark measures the duration of twice VM
>>>> instance creations.)
>>>
>>> Agreed, we should agree what we are optimizing, and why (the use case).
>>>
>>>>>>> I assume we could improve that by consolidating that metadata into a
>>>>>>> file with faster access.
>>>>>> Yes, below is what Wenlong's patch includes.
>>>>>>
>>>>>> +# The modulelibrarymapping properties show class libraries in each module.
>>>>> I saw that, but not sure which problem it is solving
>>>>> (seek times/parsing/other). Also, of course, this is a copy of the
>>>>> metadata that we would need to keep in sync with changes to the module
>>>>> manifests. I'd like the best of both worlds :-)
>>>>
>>>> Right. A "better" solution I can think of is, the runtime can extract
>>>> this information at build time or installation time. It can be the
>>>> next step if we think it is a valid solution.
>>>
>>> The OSGi frameworks must have this problem already. They need to
>>> maintain a cache of bundles installed in the runtime without it being a
>>> surprise each time they start up. While Wenlong's static cache is fine
>>> for the prototype, there may be some code in Felix/whatever that we can
>>> use to dynamically manage cached metadata for our modules.
>>
>> Agreed. This kind of dynamic Felix-based way probably will be a long
>> term ultimate solution.
>>
>>> p.s. Please don't take my comments as negative about the approach here.
>>> I'm delighted to see this type of innovative work taking place.
>>
>> Definitely not negative. Comments are always welcome. And I think
>> Harmony community needs more comments. :)
>>
>>> Regards,
>>> Tim
>>>
>>>
>>
>>
>>
>> --
>> http://xiao-feng.blogspot.com
>>
>
Re: [vm] Implement on-demand class library parsing to avoid unnecessary jar/zip parsing during startup (HARMONY-6039)
Posted by Nathan Beyer <nd...@apache.org>.
I like the proposal, but I'd like to see an addition that either
negates the duplication of manifest information or automates the
generation of it. The later may be easiest - add a bit to the build
that reads the manifests and generates the file.
-Nathan
On Wed, Dec 10, 2008 at 8:22 AM, Xiao-Feng Li <xi...@gmail.com> wrote:
> On Wed, Dec 10, 2008 at 10:07 PM, Tim Ellison <t....@gmail.com> wrote:
>> Xiao-Feng Li wrote:
>>> On Wed, Dec 10, 2008 at 9:11 PM, Tim Ellison <t....@gmail.com> wrote:
>>>> So my question is where is the time being saved using this technique?
>>>>
>>>> Is it the number of files we touch? e.g. disc seek time, or is it
>>>> searching through the ZIP directories looking for class files e.g. poor
>>>> ZIP performance for our usage, or ...
>>>>
>>>> Given that the cold start times improve by 85% (20s down to 3s), and
>>>> warm start improves by ~18% (170ms down to 140ms), it is most likely the
>>>> 'getting the bits off disc' part. Does that sound right? Can we
>>>> measure it?
>>>
>>> I am also wondering about it. There are two ways to save time: one is
>>> to reduce the number of JARs by repackaging all the classes; the other
>>> is to reduce the number of JARs loaded. As I know, the first approach
>>> helps little. That probably means the disk seeking time is the major
>>> contributor of startup time.
>>>
>>> If this hypothesis is correct, then to delay the loading of JARs can
>>> benefit even if all the JARs are needed in the end by an application.
>>> The reason is the IO time can be overlapped with the computation time.
>>
>> Yes, especially if we have the metadata that tells us where the classes
>> are stored. We can queue requests to load multiple class files
>> asynchronously in the file system.
>>
>>> Well, this solution might not really help, if an application (or
>>> benchmark) only measures the period after VM is launched. (This is
>>> probably true since a Java timer can be triggered only after VM is
>>> created, unless the benchmark measures the duration of twice VM
>>> instance creations.)
>>
>> Agreed, we should agree what we are optimizing, and why (the use case).
>>
>>>>>> I assume we could improve that by consolidating that metadata into a
>>>>>> file with faster access.
>>>>> Yes, below is what Wenlong's patch includes.
>>>>>
>>>>> +# The modulelibrarymapping properties show class libraries in each module.
>>>> I saw that, but not sure which problem it is solving
>>>> (seek times/parsing/other). Also, of course, this is a copy of the
>>>> metadata that we would need to keep in sync with changes to the module
>>>> manifests. I'd like the best of both worlds :-)
>>>
>>> Right. A "better" solution I can think of is, the runtime can extract
>>> this information at build time or installation time. It can be the
>>> next step if we think it is a valid solution.
>>
>> The OSGi frameworks must have this problem already. They need to
>> maintain a cache of bundles installed in the runtime without it being a
>> surprise each time they start up. While Wenlong's static cache is fine
>> for the prototype, there may be some code in Felix/whatever that we can
>> use to dynamically manage cached metadata for our modules.
>
> Agreed. This kind of dynamic Felix-based way probably will be a long
> term ultimate solution.
>
>> p.s. Please don't take my comments as negative about the approach here.
>> I'm delighted to see this type of innovative work taking place.
>
> Definitely not negative. Comments are always welcome. And I think
> Harmony community needs more comments. :)
>
>> Regards,
>> Tim
>>
>>
>
>
>
> --
> http://xiao-feng.blogspot.com
>
Re: [vm] Implement on-demand class library parsing to avoid unnecessary jar/zip parsing during startup (HARMONY-6039)
Posted by Xiao-Feng Li <xi...@gmail.com>.
On Wed, Dec 10, 2008 at 10:07 PM, Tim Ellison <t....@gmail.com> wrote:
> Xiao-Feng Li wrote:
>> On Wed, Dec 10, 2008 at 9:11 PM, Tim Ellison <t....@gmail.com> wrote:
>>> So my question is where is the time being saved using this technique?
>>>
>>> Is it the number of files we touch? e.g. disc seek time, or is it
>>> searching through the ZIP directories looking for class files e.g. poor
>>> ZIP performance for our usage, or ...
>>>
>>> Given that the cold start times improve by 85% (20s down to 3s), and
>>> warm start improves by ~18% (170ms down to 140ms), it is most likely the
>>> 'getting the bits off disc' part. Does that sound right? Can we
>>> measure it?
>>
>> I am also wondering about it. There are two ways to save time: one is
>> to reduce the number of JARs by repackaging all the classes; the other
>> is to reduce the number of JARs loaded. As I know, the first approach
>> helps little. That probably means the disk seeking time is the major
>> contributor of startup time.
>>
>> If this hypothesis is correct, then to delay the loading of JARs can
>> benefit even if all the JARs are needed in the end by an application.
>> The reason is the IO time can be overlapped with the computation time.
>
> Yes, especially if we have the metadata that tells us where the classes
> are stored. We can queue requests to load multiple class files
> asynchronously in the file system.
>
>> Well, this solution might not really help, if an application (or
>> benchmark) only measures the period after VM is launched. (This is
>> probably true since a Java timer can be triggered only after VM is
>> created, unless the benchmark measures the duration of twice VM
>> instance creations.)
>
> Agreed, we should agree what we are optimizing, and why (the use case).
>
>>>>> I assume we could improve that by consolidating that metadata into a
>>>>> file with faster access.
>>>> Yes, below is what Wenlong's patch includes.
>>>>
>>>> +# The modulelibrarymapping properties show class libraries in each module.
>>> I saw that, but not sure which problem it is solving
>>> (seek times/parsing/other). Also, of course, this is a copy of the
>>> metadata that we would need to keep in sync with changes to the module
>>> manifests. I'd like the best of both worlds :-)
>>
>> Right. A "better" solution I can think of is, the runtime can extract
>> this information at build time or installation time. It can be the
>> next step if we think it is a valid solution.
>
> The OSGi frameworks must have this problem already. They need to
> maintain a cache of bundles installed in the runtime without it being a
> surprise each time they start up. While Wenlong's static cache is fine
> for the prototype, there may be some code in Felix/whatever that we can
> use to dynamically manage cached metadata for our modules.
Agreed. This kind of dynamic Felix-based way probably will be a long
term ultimate solution.
> p.s. Please don't take my comments as negative about the approach here.
> I'm delighted to see this type of innovative work taking place.
Definitely not negative. Comments are always welcome. And I think
Harmony community needs more comments. :)
> Regards,
> Tim
>
>
--
http://xiao-feng.blogspot.com
Re: [vm] Implement on-demand class library parsing to avoid unnecessary
jar/zip parsing during startup (HARMONY-6039)
Posted by Tim Ellison <t....@gmail.com>.
Xiao-Feng Li wrote:
> On Wed, Dec 10, 2008 at 9:11 PM, Tim Ellison <t....@gmail.com> wrote:
>> So my question is where is the time being saved using this technique?
>>
>> Is it the number of files we touch? e.g. disc seek time, or is it
>> searching through the ZIP directories looking for class files e.g. poor
>> ZIP performance for our usage, or ...
>>
>> Given that the cold start times improve by 85% (20s down to 3s), and
>> warm start improves by ~18% (170ms down to 140ms), it is most likely the
>> 'getting the bits off disc' part. Does that sound right? Can we
>> measure it?
>
> I am also wondering about it. There are two ways to save time: one is
> to reduce the number of JARs by repackaging all the classes; the other
> is to reduce the number of JARs loaded. As I know, the first approach
> helps little. That probably means the disk seeking time is the major
> contributor of startup time.
>
> If this hypothesis is correct, then to delay the loading of JARs can
> benefit even if all the JARs are needed in the end by an application.
> The reason is the IO time can be overlapped with the computation time.
Yes, especially if we have the metadata that tells us where the classes
are stored. We can queue requests to load multiple class files
asynchronously in the file system.
> Well, this solution might not really help, if an application (or
> benchmark) only measures the period after VM is launched. (This is
> probably true since a Java timer can be triggered only after VM is
> created, unless the benchmark measures the duration of twice VM
> instance creations.)
Agreed, we should agree what we are optimizing, and why (the use case).
>>>> I assume we could improve that by consolidating that metadata into a
>>>> file with faster access.
>>> Yes, below is what Wenlong's patch includes.
>>>
>>> +# The modulelibrarymapping properties show class libraries in each module.
>> I saw that, but not sure which problem it is solving
>> (seek times/parsing/other). Also, of course, this is a copy of the
>> metadata that we would need to keep in sync with changes to the module
>> manifests. I'd like the best of both worlds :-)
>
> Right. A "better" solution I can think of is, the runtime can extract
> this information at build time or installation time. It can be the
> next step if we think it is a valid solution.
The OSGi frameworks must have this problem already. They need to
maintain a cache of bundles installed in the runtime without it being a
surprise each time they start up. While Wenlong's static cache is fine
for the prototype, there may be some code in Felix/whatever that we can
use to dynamically manage cached metadata for our modules.
p.s. Please don't take my comments as negative about the approach here.
I'm delighted to see this type of innovative work taking place.
Regards,
Tim
Re: [vm] Implement on-demand class library parsing to avoid unnecessary jar/zip parsing during startup (HARMONY-6039)
Posted by Xiao-Feng Li <xi...@gmail.com>.
On Wed, Dec 10, 2008 at 9:11 PM, Tim Ellison <t....@gmail.com> wrote:
> Xiao-Feng Li wrote:
>> On Wed, Dec 10, 2008 at 6:50 PM, Tim Ellison <t....@gmail.com> wrote:
>>> This is cool.
>>>
>>> Wenlong Li (JIRA) wrote:
>>>> During VM creation, Harmony will parse all class libraried defined in
>>>> bootclasspath.properties under jre/lib/boot directory. However, not
>>>> all class libraries are accessed during startup. That means, it is
>>>> not necessary to open and resolve all these class libraries.
>>> Agreed.
>>>
>>>> In this patch, I implement the on-demand jar parsing. I leverage the
>>>> class library info defined in the manifest file of each module. For a
>>>> request class, if it is not available in existing class table, I then
>>>> parse its class library info, and check which module contains this
>>>> requested class. That is, I parse the class library on demand.
>>> Its good to see the manifest information being used at runtime.
>>>
>>> So as I understand it, you are not looking to provide any isolation
>>> between modules, just using the metadata to direct the search path.
>>>
>>>> Using on-demand class library parsing, I can reduce the VM creation
>>>> time from 20+ seconds to 3 seconds.
>>> Wow, that's remarkable. Is ZIP file directory performance really that bad?
>>>
>>> I'm assuming that it is multiple VM creations (it doesn't take 20s to
>>> invoke the VM usually!) And that is still opening and reading the
>>> manifest from each JAR?
>>
>> Cold start (first time launch) and warm start (not first time launch)
>> have very different numbers, because of the disk access caching
>> effect. The numbers in seconds should be cold start. I remember in
>> Wenlong's data given early, this work can improve the warm start time
>> as well, something like from 170ms to 140ms.
>
> Luckily, I've never seen a 20s start up time.
>
> So my question is where is the time being saved using this technique?
>
> Is it the number of files we touch? e.g. disc seek time, or is it
> searching through the ZIP directories looking for class files e.g. poor
> ZIP performance for our usage, or ...
>
> Given that the cold start times improve by 85% (20s down to 3s), and
> warm start improves by ~18% (170ms down to 140ms), it is most likely the
> 'getting the bits off disc' part. Does that sound right? Can we
> measure it?
I am also wondering about it. There are two ways to save time: one is
to reduce the number of JARs by repackaging all the classes; the other
is to reduce the number of JARs loaded. As I know, the first approach
helps little. That probably means the disk seeking time is the major
contributor of startup time.
If this hypothesis is correct, then to delay the loading of JARs can
benefit even if all the JARs are needed in the end by an application.
The reason is the IO time can be overlapped with the computation time.
Well, this solution might not really help, if an application (or
benchmark) only measures the period after VM is launched. (This is
probably true since a Java timer can be triggered only after VM is
created, unless the benchmark measures the duration of twice VM
instance creations.)
>>> I assume we could improve that by consolidating that metadata into a
>>> file with faster access.
>>
>> Yes, below is what Wenlong's patch includes.
>>
>> +# The modulelibrarymapping properties show class libraries in each module.
>
> I saw that, but not sure which problem it is solving
> (seek times/parsing/other). Also, of course, this is a copy of the
> metadata that we would need to keep in sync with changes to the module
> manifests. I'd like the best of both worlds :-)
Right. A "better" solution I can think of is, the runtime can extract
this information at build time or installation time. It can be the
next step if we think it is a valid solution.
Thanks,
xiaofeng
> Regards,
> Tim
>
--
http://xiao-feng.blogspot.com
Re: [vm] Implement on-demand class library parsing to avoid unnecessary
jar/zip parsing during startup (HARMONY-6039)
Posted by Tim Ellison <t....@gmail.com>.
Xiao-Feng Li wrote:
> On Wed, Dec 10, 2008 at 6:50 PM, Tim Ellison <t....@gmail.com> wrote:
>> This is cool.
>>
>> Wenlong Li (JIRA) wrote:
>>> During VM creation, Harmony will parse all class libraried defined in
>>> bootclasspath.properties under jre/lib/boot directory. However, not
>>> all class libraries are accessed during startup. That means, it is
>>> not necessary to open and resolve all these class libraries.
>> Agreed.
>>
>>> In this patch, I implement the on-demand jar parsing. I leverage the
>>> class library info defined in the manifest file of each module. For a
>>> request class, if it is not available in existing class table, I then
>>> parse its class library info, and check which module contains this
>>> requested class. That is, I parse the class library on demand.
>> Its good to see the manifest information being used at runtime.
>>
>> So as I understand it, you are not looking to provide any isolation
>> between modules, just using the metadata to direct the search path.
>>
>>> Using on-demand class library parsing, I can reduce the VM creation
>>> time from 20+ seconds to 3 seconds.
>> Wow, that's remarkable. Is ZIP file directory performance really that bad?
>>
>> I'm assuming that it is multiple VM creations (it doesn't take 20s to
>> invoke the VM usually!) And that is still opening and reading the
>> manifest from each JAR?
>
> Cold start (first time launch) and warm start (not first time launch)
> have very different numbers, because of the disk access caching
> effect. The numbers in seconds should be cold start. I remember in
> Wenlong's data given early, this work can improve the warm start time
> as well, something like from 170ms to 140ms.
Luckily, I've never seen a 20s start up time.
So my question is where is the time being saved using this technique?
Is it the number of files we touch? e.g. disc seek time, or is it
searching through the ZIP directories looking for class files e.g. poor
ZIP performance for our usage, or ...
Given that the cold start times improve by 85% (20s down to 3s), and
warm start improves by ~18% (170ms down to 140ms), it is most likely the
'getting the bits off disc' part. Does that sound right? Can we
measure it?
>> I assume we could improve that by consolidating that metadata into a
>> file with faster access.
>
> Yes, below is what Wenlong's patch includes.
>
> +# The modulelibrarymapping properties show class libraries in each module.
I saw that, but not sure which problem it is solving
(seek times/parsing/other). Also, of course, this is a copy of the
metadata that we would need to keep in sync with changes to the module
manifests. I'd like the best of both worlds :-)
Regards,
Tim
Re: [vm] Implement on-demand class library parsing to avoid unnecessary jar/zip parsing during startup (HARMONY-6039)
Posted by Xiao-Feng Li <xi...@gmail.com>.
On Wed, Dec 10, 2008 at 6:50 PM, Tim Ellison <t....@gmail.com> wrote:
> This is cool.
>
> Wenlong Li (JIRA) wrote:
>> During VM creation, Harmony will parse all class libraried defined in
>> bootclasspath.properties under jre/lib/boot directory. However, not
>> all class libraries are accessed during startup. That means, it is
>> not necessary to open and resolve all these class libraries.
>
> Agreed.
>
>> In this patch, I implement the on-demand jar parsing. I leverage the
>> class library info defined in the manifest file of each module. For a
>> request class, if it is not available in existing class table, I then
>> parse its class library info, and check which module contains this
>> requested class. That is, I parse the class library on demand.
>
> Its good to see the manifest information being used at runtime.
>
> So as I understand it, you are not looking to provide any isolation
> between modules, just using the metadata to direct the search path.
>
>> Using on-demand class library parsing, I can reduce the VM creation
>> time from 20+ seconds to 3 seconds.
>
> Wow, that's remarkable. Is ZIP file directory performance really that bad?
>
> I'm assuming that it is multiple VM creations (it doesn't take 20s to
> invoke the VM usually!) And that is still opening and reading the
> manifest from each JAR?
Cold start (first time launch) and warm start (not first time launch)
have very different numbers, because of the disk access caching
effect. The numbers in seconds should be cold start. I remember in
Wenlong's data given early, this work can improve the warm start time
as well, something like from 170ms to 140ms.
> I assume we could improve that by consolidating that metadata into a
> file with faster access.
Yes, below is what Wenlong's patch includes.
+# The modulelibrarymapping properties show class libraries in each module.
+#
+# Upon class request, the VM checks which module contains this class
library, and then
+# open the module to read all classes within this element.
+# The on-demand class library parsing is enabled for fast application
startup by reducing
+# the number of class libraries loaded during startup, which
minimizes unnecessary I/O operations.
+#
+# The launcher option -Xbootclasspath overrides this features.
+#
+
+accessibility.jar=javax.accessibility
+applet.jar=java.applet
+auth.jar=javax.security.auth,javax.security.auth.callback,javax.security.auth.kerberos,javax.security.auth.login,javax.security.auth.spi,javax.security.auth.x500,javax.security.sasl,org.ietf.jgss
+awt.jar=java.awt,java.awt.color,java.awt.datatransfer,java.awt.dnd,java.awt.dnd.peer,java.awt.event,java.awt.font,java.awt.geom,java.awt.im,java.awt.im.spi,java.awt.image,java.awt.image.renderable,java.awt.peer,java.awt.print,org.apache.harmony.awt,org.apache.harmony.awt.gl,org.apache.harmony.awt.gl.image,org.apache.harmony.awt.gl.windows,org.apache.harmony.awt.nativebridge,org.apache.harmony.awt.nativebridge.windows,org.apache.harmony.awt.text
+beans.jar=java.beans,java.beans.beancontext
+crypto.jar=javax.crypto,javax.crypto.interfaces,javax.crypto.spec
+imageio.jar=javax.imageio
+instrument.jar=java.lang.instrument
+jndi.jar=javax.naming,javax.naming.directory,javax.naming.event,javax.naming.ldap,javax.naming.spi
+lang-management.jar=java.lang.management
+logging.jar=java.util.logging
+math.jar=java.math
+prefs.jar=java.util.prefs
+print.jar=javax.print,javax.print.attribute,javax.print.attribute.standard,javax.print.event,org.apache.harmony.x.print
+regex.jar=java.util.regex
+rmi.jar=java.rmi,java.rmi.activation,java.rmi.dgc,java.rmi.registry,java.rmi.server,javax.activity,org.apache.harmony.rmi.transport
+sound.jar=javax.sound.midi,javax.sound.midi.spi
+sql.jar=java.sql,javax.sql,javax.sql.rowset,javax.sql.rowset.spi,javax.transaction,javax.transaction.xa
+swing.jar=javax.swing,javax.swing.border,javax.swing.colorchooser,javax.swing.event,javax.swing.filechooser,javax.swing.plaf,javax.swing.plaf.basic,javax.swing.plaf.metal,javax.swing.table,javax.swing.text,javax.swing.text.html,javax.swing.text.html.parser,javax.swing.tree,javax.swing.undo
+text.jar=java.text
+x-net.jar=javax.net,javax.net.ssl,org.apache.harmony.xnet.provider.jsse
+icu4j_3.8\\icu4j-charsets-3_8.jar=com.ibm.icu.lang,com.ibm.icu.math,com.ibm.icu.text,com.ibm.icu.util,com.ibm.icu.charset
+xalan-j_2.7.0\\xalan.jar=org.apache.xpath,org.apache.xpath.objects
+xerces_2.9.1\\resolver.jar=org.apache.env,org.apache.xml.resolver
+xerces_2.9.1\\xercesImpl.jar=org.apache.xerces.impl,org.xml.sax,org.w3c.dom,org.w3c.dom.ls,javax.xml.datatype,javax.xml.parsers,,javax.xml.transform,javax.xml.validation.javax.xml.xpath.org.apache.xerces.xni
+xerces_2.9.1\\xml-apis.jar=org.apache.xmlcommons.Version,org.xml.sax,org.w3c.dom,org.w3c.dom.ls,javax.xml.parsers,javax.xml.transform,javax.xml.validation,javax.xml.datatype,javax.xml.xpath
+mx4j_3.0.2\\mx4j.jar=javax.management,javax.management.loading,javax.management.modelmbean,javax.management.monitor,javax.management.openmbean,javax.management.relation,javax.management.timer
+mx4j_3.0.2\\mx4j-remote.jar=javax.management,javax.management.loading,javax.management.modelmbean,javax.management.monitor,javax.management.openmbean,javax.management.relation,javax.management.timer
+yoko-1.0-SNAPSHOT-20080304\\yoko.jar=org.omg
+yoko-1.0-SNAPSHOT-20080304\\yoko-core.jar=org.apache.yoko.orb
+yoko-1.0-SNAPSHOT-20080304\\yoko-rmi-spec.jar=org.apache.yoko.rmispec.util
+yoko-1.0-SNAPSHOT-20080304\\yoko-rmi-impl.jar=org.apache.yoko.rmi
+bcel-5.2\\bcel-5.2.jar=org.apache.bcel
+pack200.jar=org.apache.harmony.pack200,org.apache.harmony.unpack200,org.apache.harmony.unpack200.bytecode,org.apache.harmony.unpack200.bytecode.forms
+misc.jar=org.apache.harmony.misc,org.apache.harmony.misc.accessors
Thanks,
xiaofeng
>> I enable this feature into reading boot class path option, and it can
>> be disabled by using -Xbootclasspath option.
>
> Regards,
> Tim
>
--
http://xiao-feng.blogspot.com