OrientDB慢写 [英] OrientDB slow write

查看:216
本文介绍了OrientDB慢写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OrientDB官方网站说:

OrientDB official site says:


在普通硬件商店中,每秒高达150,000个文档,每个文件10亿美元bb天。大图加载几个
毫秒而不执行昂贵的JOIN,例如Relational
DBMS。

On common hardware stores up to 150.000 documents per second, 10 billions of documents per day. Big Graphs are loaded in few milliseconds without executing costly JOIN such as the Relational DBMSs.

但是,执行以下代码表明,插入150000个简单文档需要大约17000ms。

But, executing the following code shows that it's taking ~17000ms to insert 150000 simple documents.

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.record.impl.ODocument;

public final class OrientDBTrial {

    public static void main(String[] args) {
        ODatabaseDocumentTx db = new ODatabaseDocumentTx("remote:localhost/foo");
        try {
            db.open("admin", "admin");

            long a = System.currentTimeMillis();
            for (int i = 1; i < 150000; ++i) {
                final ODocument foo = new ODocument("Foo");
                foo.field("code", i);
                foo.save();
            }
            long b = System.currentTimeMillis();
            System.out.println(b - a + "ms");

            for (ODocument doc : db.browseClass("Foo")) {
                doc.delete();
            }
        } finally {
            db.close();
        }
    }

}

我的硬件:


  • Dell Optiplex 780

  • Intel(R)Core(TM)2 Duo CPU E7500 @ 2.93Ghz

  • 8GB RAM

  • Windows 7 64位

  • Dell Optiplex 780
  • Intel(R) Core(TM)2 Duo CPU E7500 @ 2.93Ghz
  • 8GB RAM
  • Windows 7 64bits

我做错了什么?

在10个并发线程中拆分保存以最大限度地减少Java的开销,使其在~13000ms内运行。仍比OrientDB首页所说的慢得多。

Splitting the saves in 10 concurrent threads to minimize Java's overhead made it run in ~13000ms. Still far slower than what OrientDB front page says.

推荐答案

你可以通过使用'Flat Database'和orientdb作为嵌入式实现java中的库
请参阅此处更多解释
http:// code。 google.com/p/orient/wiki/JavaAPI

You can achieve that by using 'Flat Database' and orientdb as an embedded library in java see more explained here http://code.google.com/p/orient/wiki/JavaAPI

您使用的是服务器模式,它向orientdb服务器发送了许多请求,
判断根据你的基准测试,你每秒可以获得~10 000次插入,这也不错,
例如我认为10 000个请求/ s对于任何网络服务器都是非常好的性能
(并且orientdb服务器实际上是一个网络服务器,你可以通过http查询它,但我认为java正在使用二进制模式)

what you use is server mode and it sends many requests to orientdb server, judging by your benchmark you got ~10 000 inserts per seconds which is not bad, e.g I think 10 000 requests/s is very good performance for any webserver (and orientdb server actually is a webserver and you can query it through http, but I think java is using binary mode)

这篇关于OrientDB慢写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆