hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BlueDavy Lin <blued...@gmail.com>
Subject Client bug about HTable threadpool?
Date Thu, 10 Mar 2011 02:54:27 GMT
hi!

        HBase Version: 0.90.1

        In HTable Constructor method public HTable(Configuration conf,
final byte [] tableName)
        create a ThreadPoolExecutor:
           int nrThreads = conf.getInt("hbase.htable.threads.max",
getCurrentNrHRS());
           if (nrThreads == 0) {
              nrThreads = 1; // is there a better default?
           }

          // Unfortunately Executors.newCachedThreadPool does not allow us to
         // set the maximum size of the pool, so we have to do it ourselves.
         this.pool = new ThreadPoolExecutor(0, nrThreads,
             60, TimeUnit.SECONDS,
             new LinkedBlockingQueue<Runnable>(),
             new DaemonThreadFactory());

         According ThreadPoolExecutor Implemenation,the pool will only
create one thread to execute task,except LinkedBlockingQueue exceed
Integer.MAX_VALUE.

         So even if u set hbase.htable.threads.max > 1, but it still
will create one thread to handle, so I think should change above code
to below:

         this.pool = new ThreadPoolExecutor(nrThreads, nrThreads,
             60, TimeUnit.SECONDS,
             new LinkedBlockingQueue<Runnable>(),
             new DaemonThreadFactory());

-- 
=============================
|     BlueDavy                                      |
|     http://www.bluedavy.com                |
=============================

Mime
View raw message