UnInvertedField.getUnInvertedField()&上的多个阻塞线程SegmentReader $ CoreReaders.getTermsReader

时间:2011-02-22 14:17:19

标签: performance solr faceted-search blocked-threads

1 个答案:

答案 0 :(得分:0)

我也在测试中遇到过这个问题。我发现下面代码附近的块很有趣:

SimpleFSDirectory.readInternal

protected void readInternal(byte[] b, int offset, int len)
     throws IOException {
  synchronized (file) {
    long position = getFilePointer();
    if (position != file.position) {
      file.seek(position);
      file.position = position;
    }
    int total = 0;

    try {
      do {
        final int readLength;
        if (total + chunkSize > len) {
          readLength = len - total;
        } else {
          // LUCENE-1566 - work around JVM Bug by breaking very large reads into chunks
          readLength = chunkSize;
        }
        final int i = file.read(b, offset + total, readLength);
        if (i == -1) {
          throw new IOException("read past EOF");
        }
        file.position += i;
        total += i;
      } while (total < len);
    } catch (OutOfMemoryError e) {
      // propagate OOM up and add a hint for 32bit VM Users hitting the bug
      // with a large chunk size in the fast path.
      final OutOfMemoryError outOfMemoryError = new OutOfMemoryError(
          "OutOfMemoryError likely caused by the Sun VM Bug described in "
          + "https://issues.apache.org/jira/browse/LUCENE-1566; try calling FSDirectory.setReadChunkSize "
          + "with a a value smaller than the current chunks size (" + chunkSize + ")");
      outOfMemoryError.initCause(e);
      throw outOfMemoryError;
    }
  }
}

我猜你的solr是像我一样在windows上构建的。您可以使用以下帖子中的“代码补丁”:Use NIO positional read to avoid synchronization in FSIndexInput