Karaf
  1. Karaf
  2. KARAF-1218

Only use 1 thread for file installer watcher

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.2.5
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      When running Apache Karaf 2.2.5 then we want to run it with as low overhead as possible. Out of the box it has around 30+ live threads running, which is a fair bit.

      We should try to consolidate if applicable. For example there is 2 separate threads for picking up file installer. This can be implemented as a single thread instead.

      "fileinstall-/opt/apache-karaf-2.2.5/deploy" daemon prio=5 tid=7fa0cc26d800 nid=0x1104ec000 in Object.wait() [1104eb000]
         java.lang.Thread.State: TIMED_WAITING (on object monitor)
      	at java.lang.Object.wait(Native Method)
      	- waiting on <7e0690610> (a org.apache.felix.fileinstall.internal.DirectoryWatcher)
      	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:268)
      	- locked <7e0690610> (a org.apache.felix.fileinstall.internal.DirectoryWatcher)
      
      "fileinstall-/opt/apache-karaf-2.2.5/etc" daemon prio=5 tid=7fa0cc26a800 nid=0x1103e9000 in Object.wait() [1103e8000]
         java.lang.Thread.State: TIMED_WAITING (on object monitor)
      	at java.lang.Object.wait(Native Method)
      	- waiting on <7e068e778> (a org.apache.felix.fileinstall.internal.DirectoryWatcher)
      	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:268)
      	- locked <7e068e778> (a org.apache.felix.fileinstall.internal.DirectoryWatcher)
      

      Those 2 thread should be a single thread, that just watches the 2 directories.

        Activity

        Hide
        Achim Nierbeck added a comment -

        regarding the file-installer, afaik since it uses a service-factory, a thread is created for every configuration found, so basically if you add another configuration for another directory you end up with another thread. Another thing, each of the file-installer thread can be configured differently regarding scheduling and file-filtering. So I'd guess we better stick to those two threads left over.

        Show
        Achim Nierbeck added a comment - regarding the file-installer, afaik since it uses a service-factory, a thread is created for every configuration found, so basically if you add another configuration for another directory you end up with another thread. Another thing, each of the file-installer thread can be configured differently regarding scheduling and file-filtering. So I'd guess we better stick to those two threads left over.
        Hide
        Claus Ibsen added a comment -

        Also there is 2 other main threads. It would be nice to give this threads a better name, than just Thread-2 and Thread-3.

        "Thread-3" daemon prio=5 tid=7fa0cb206800 nid=0x1100e0000 runnable [1100df000]
           java.lang.Thread.State: RUNNABLE
        	at java.net.PlainSocketImpl.socketAccept(Native Method)
        	at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:408)
        	- locked <7e008c160> (a java.net.SocksSocketImpl)
        	at java.net.ServerSocket.implAccept(ServerSocket.java:462)
        	at java.net.ServerSocket.accept(ServerSocket.java:430)
        	at org.apache.karaf.main.Main$ShutdownSocketThread.run(Main.java:1394)
        
        "Thread-2" prio=5 tid=7fa0cc2c7800 nid=0x10ffdd000 waiting on condition [10ffdc000]
           java.lang.Thread.State: TIMED_WAITING (sleeping)
        	at java.lang.Thread.sleep(Native Method)
        	at org.apache.karaf.main.Main.doLock(Main.java:1302)
        	at org.apache.karaf.main.Main.lock(Main.java:1277)
        	at org.apache.karaf.main.Main$1.run(Main.java:277)
        
        Show
        Claus Ibsen added a comment - Also there is 2 other main threads. It would be nice to give this threads a better name, than just Thread-2 and Thread-3. " Thread -3" daemon prio=5 tid=7fa0cb206800 nid=0x1100e0000 runnable [1100df000] java.lang. Thread .State: RUNNABLE at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:408) - locked <7e008c160> (a java.net.SocksSocketImpl) at java.net.ServerSocket.implAccept(ServerSocket.java:462) at java.net.ServerSocket.accept(ServerSocket.java:430) at org.apache.karaf.main.Main$ShutdownSocketThread.run(Main.java:1394) " Thread -2" prio=5 tid=7fa0cc2c7800 nid=0x10ffdd000 waiting on condition [10ffdc000] java.lang. Thread .State: TIMED_WAITING (sleeping) at java.lang. Thread .sleep(Native Method) at org.apache.karaf.main.Main.doLock(Main.java:1302) at org.apache.karaf.main.Main.lock(Main.java:1277) at org.apache.karaf.main.Main$1.run(Main.java:277)
        Hide
        Claus Ibsen added a comment -

        There is also a number of Blueprint Extender threads, wonder if we need that many?

        Show
        Claus Ibsen added a comment - There is also a number of Blueprint Extender threads, wonder if we need that many?
        Claus Ibsen created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Claus Ibsen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development