2

I can execute this query below just fine through web interface. It takes virtually no time at all to finish.

SELECT from Person;

But when I try to do it from my Java application, it takes more than 17 seconds to finish.

The code I'm using is basically this two lines:

OrientGraph graph = new OrientGraph("remote:93.x.x.x/test");
OCommandRequest req = graph.command(new OCommandSQL(query));
req.execute();

Could it be that the REST requests are so much slower? Web interface is using plocal (I guess), while my Java app uses remote connection.

Blaž
  • 67
  • 4
  • After that you run this query for the first time, the next time it is executed takes a shorter time or the response time is always about the same? Because in the warm up it is normal that the db employs has a response time of a little higher. – Michela Bonizzi Jan 21 '16 at 23:44
  • It does get a bit faster, after the second run it stays around 15 s. Which is still way slower than executing the query from web interface, where response is almost instant. – Blaž Jan 23 '16 at 09:59
  • I am too late to comment but I have seen this behaviour too. The first time on a read operation it takes 8 sec whereas hitting same query again from java finishes in less than 50ms. When inputs change the behaviour replicates. Using version 3.x . Could you guys find out why? – 89n3ur0n Jul 19 '21 at 18:43

1 Answers1

2

Try to run the same query also from the console. The time spent in the console should be about the same (just a little slower than that in java). I did a test inserting 100,000 Vertex class Person. Doing various query response times is: Studio = 7.72 sec, Console = 2,043 sec, Java = 1:23 to 1:41 sec enter image description here

If revenues from a very different time, perhaps something is wrong in java. You have shown "OCommandSQL", check with "OSQLSynchQuery" to see if there is a great difference.

    String query = "";
    Iterable<Vertex> result;

    query = "select from Persona";

    //query with OSQLSynchQuery
    result = g.command(new OSQLSynchQuery<Vertex>(query)).execute();
    List<OrientVertex> listVertex = new ArrayList<OrientVertex>();
    CollectionUtils.addAll(listVertex, result.iterator());

    //query with OCommandSQL        
    OCommandRequest req = g.command(new OCommandSQL(query));
    req.execute();
lsavio
  • 850
  • 4
  • 10
  • I now tried the query from console, and the time is bellow 1 second. I also tried the OSQLSynchQuery, but the times stay the same. I guess it's something with java. I will try this from another system to see if there is some difference. – Blaž Jan 23 '16 at 11:53