tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Mikhulya (JIRA)" <j...@apache.org>
Subject [jira] [Created] (TAP5-2546) Parallel class loading
Date Sat, 14 May 2016 07:11:12 GMT
Michael Mikhulya created TAP5-2546:
--------------------------------------

             Summary: Parallel class loading
                 Key: TAP5-2546
                 URL: https://issues.apache.org/jira/browse/TAP5-2546
             Project: Tapestry 5
          Issue Type: Improvement
          Components: plastic
            Reporter: Michael Mikhulya


I would like to improve page loading time by improving its concurrent execution.

Here is a first patch related to it: TAP5-2545

Now the worst place from lock contention point of view is synchronization on {{PlasticClassLoader}}.
Actually there are two kind of synchronization: {{synchronized}} methods in {{PlasticClassLoader}}
and {{synchronized (loader)}} sections in {{PlasticClassPool}}.

Recently most class loaders added support for parallel class loading:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=464442
https://bz.apache.org/bugzilla/show_bug.cgi?id=57681

If we would like to split global lock, then we can use following trick for it.

We can substitute code like this:
{code:title=PlasticClassLoader.java}
    public synchronized Class<?> defineClassWithBytecode(String className, byte[] bytecode)
    {
        return defineClass(className, bytecode, 0, bytecode.length);
    }
{code}

with following one:

{code:java}
    public Class<?> defineClassWithBytecode(String className, byte[] bytecode)
    {
        synchronized (className.intern())
        {
            return defineClass(className, bytecode, 0, bytecode.length);
        }
    }
{code}

It is just an idea to quickly check solution.

Can anybody check and discuss idea? Or even better to fix issue. :-)
I'm not an expert in concurrency and afraid making changes in such a critical place at least
before somebody reviewed my idea. So any feedback would be appreciated. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message