清除OrientDB 2.2.6中的固定页面

时间:2016-10-05 15:01:20

标签: orientdb orientdb2.2

我在Windows 7(64位)上运行OrientDB 2.2.6,当我在Java 8中运行TestNG测试时,我不断收到以下警告。

2016-10-05 10:46:10:888 WARNI {db=orientSystemDb} Maximum amount of pinned pages is 
  reached, given page OReadCacheEntry{fileId=7136553380276606136, pageIndex=0,
  dataPointer=OCachePointer{referrersCount=1, usagesCount=0}, dirty=false, usagesCount=1} 
  will not be marked as pinned which may lead to performance degradation. You may consider
  to increase percent of pined pages by changing of property storage.diskCache.pinnedPages
  [O2QCache]

我现在不想增加pinnedPages的百分比,因为内存使用量可能会有限。我想要做的是清除数据库启动时固定的页面,看看是否能解决问题。

这是我的配置文件:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<orient-server>
<handlers>
    <handler class="com.orientechnologies.orient.graph.handler.OGraphServerHandler">
        <parameters>
            <parameter value="true" name="enabled"/>
            <parameter value="50" name="graph.pool.max"/>
        </parameters>
    </handler>
    <handler class="com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin">
        <parameters>
            <parameter value="${distributed}" name="enabled"/>
            <parameter value="${ORIENTDB_HOME}/config/default-distributed-db-config.json" name="configuration.db.default"/>
            <parameter value="${ORIENTDB_HOME}/config/hazelcast.xml" name="configuration.hazelcast"/>
        </parameters>
    </handler>
    <handler class="com.orientechnologies.orient.server.handler.OJMXPlugin">
        <parameters>
            <parameter value="false" name="enabled"/>
            <parameter value="true" name="profilerManaged"/>
        </parameters>
    </handler>
    <handler class="com.orientechnologies.orient.server.handler.OAutomaticBackup">
        <parameters>
            <parameter value="false" name="enabled"/>
            <parameter value="${ORIENTDB_HOME}/config/automatic-backup.json" name="config"/>
        </parameters>
    </handler>
    <handler class="com.orientechnologies.orient.server.handler.OServerSideScriptInterpreter">
        <parameters>
            <parameter value="true" name="enabled"/>
            <parameter value="SQL" name="allowedLanguages"/>
        </parameters>
    </handler>
</handlers>
<network>
    <protocols>
        <protocol implementation="com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary" name="binary"/>
        <protocol name="http" implementation="com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpDb"/>
    </protocols>
    <listeners>
        <listener protocol="binary" socket="default" port-range="2424-2430" ip-address="0.0.0.0"/>
        <listener protocol="http" port-range="2480-2485" ip-address="0.0.0.0">
            <commands>
                <command implementation="com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent" pattern="GET|www GET|studio/ GET| GET|*.htm GET|*.html GET|*.xml GET|*.jpeg GET|*.jpg GET|*.png GET|*.gif GET|*.js GET|*.css GET|*.swf GET|*.ico GET|*.txt GET|*.otf GET|*.pjs GET|*.svg">
                    <parameters>
                        <entry value="Cache-Control: no-cache, no-store, max-age=0, must-revalidate\r\nPragma: no-cache" name="http.cache:*.htm *.html"/>
                        <entry value="Cache-Control: max-age=120" name="http.cache:default"/>
                    </parameters>
                </command>
            </commands>
        </listener>
    </listeners>
</network>
<users>
    <user resources="*" password="root" name="root"/>
    <user resources="connect,server.listDatabases,server.dblist" password="guest" name="guest"/>
</users>
<properties>
    <entry value="1" name="db.pool.min"/>
    <entry value="50" name="db.pool.max"/>
    <entry value="true" name="profiler.enabled"/>
    <!-- Avoid updating versions when created or deleting edges -->
    <entry value="-1" name="ridBag.embeddedToSbtreeBonsaiThreshold"/>
    </properties>
</orient-server>

以下是创建边缘的代码:

private int connectToAllOtherVertices(OrientBaseGraph oGraph, OrientVertex oVertex)
{
  int numConnections = 0;

  for(Vertex v : oGraph.getVertices())
  {
    if(v.equals(oVertex))
    {
      // skip it
      continue;
    }

    oVertex.addEdge(String.format("connection%s", numConnections), v);
    numConnections++;
  }

  return numConnections;
}

我能够创建边缘,但我不断收到上述警告。如何在运行测试之前清除固定页面?

1 个答案:

答案 0 :(得分:0)

固定页面是磁盘缓存的特殊区域,只有在OrientDB存储关闭时才会从RAM中卸载。因此,您可以尝试使用closeStorage方法。请参阅javadoc