Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-2289

PhoenixContextExecutor spends a lot of time in getClassLoader

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.3.0
    • Fix Version/s: 4.6.0
    • Component/s: None
    • Labels:
      None

      Description

      Doing some "poor man's profiling" of a CSV bulk import job, I noticed a lot of time spent in this stack:

      "main" prio=10 tid=0x00007f3410018000 nid=0x6f3f runnable [0x00007f3414b4e000]
         java.lang.Thread.State: RUNNABLE
      	at java.lang.Class.getClassLoader0(Native Method)
      	at java.lang.Class.getClassLoader(Class.java:609)
      	at org.apache.phoenix.util.PhoenixContextExecutor$CurrentContextWrapper.before(PhoenixContextExecutor.java:45)
      	at org.apache.phoenix.call.CallRunner.run(CallRunner.java:51)
      	at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:270)
      	at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:211)
      	at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:174)
      	at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:179)
      	at org.apache.phoenix.util.csv.CsvUpsertExecutor.execute(CsvUpsertExecutor.java:155)
      	at org.apache.phoenix.util.csv.CsvUpsertExecutor.execute(CsvUpsertExecutor.java:136)
      	at org.apache.phoenix.mapreduce.CsvToKeyValueMapper.map(CsvToKeyValueMapper.java:163)
      	at org.apache.phoenix.mapreduce.CsvToKeyValueMapper.map(CsvToKeyValueMapper.java:69)
      

      Class.getClassLoader is relatively expensive (see http://bugs.java.com/view_bug.do?bug_id=6642881 ) so it may make sense to cache this classloader as a static final member of the class.

        Attachments

        1. PHOENIX-2289.patch
          2 kB
          Gabriel Reid

          Activity

            People

            • Assignee:
              gabriel.reid Gabriel Reid
              Reporter:
              tlipcon Todd Lipcon
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: