Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand(out("edgeName")) VS Expand(out("edgeName").@RID) Performance Difference #3384

Closed
brandonburkett opened this issue Jan 13, 2015 · 13 comments
Assignees
Milestone

Comments

@brandonburkett
Copy link

Hello,

We have run into an odd performance issue with 2.0-SNAPSHOT with expand(). It seems that if you expand on an edge and include dot RID, it is much faster than if you do not. Oddly, both return the same data (whereas expand(out("edgeName").realProperty) only returns the realProperty field).

I am unsure if this is normal behavior or not, but we are seeing approx. 300ms performance difference.

Also, we are seeing some sizes of negative 1 (see "in_hasConcept" column). Note that Attractions have multiple concepts.

orientdb {db=test}> select expand(out("hasConcept")) from Attraction where name = "Hotel ABC" limit 1000

----+-------+-------+-------------------+-------------------+-------------------------+-------+-------------+---------------
#   |@RID   |@CLASS |updatedAt          |createdAt          |name                     |archive|in_hasConcept|out_hasCategory
----+-------+-------+-------------------+-------------------+-------------------------+-------+-------------+---------------
0   |#22:234|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|air conditioning         |false  |[size=-1]    |[size=1]       
1   |#22:266|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|biking                   |false  |[size=-1]    |[size=1]       
2   |#22:235|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|business                 |false  |[size=-1]    |[size=1]       
3   |#22:236|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|city                     |false  |[size=-1]    |[size=1]       
4   |#22:245|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|eco-friendly             |false  |[size=-1]    |[size=1]       
5   |#22:255|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|fishing                  |false  |[size=-1]    |[size=1]       
6   |#22:237|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|fitness facilities       |false  |[size=-1]    |[size=1]       
7   |#22:247|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|food and wine            |false  |[size=-1]    |[size=1]       
8   |#22:256|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|handicap accessible rooms|false  |[size=-1]    |[size=1]       
9   |#22:238|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|high-speed internet      |false  |[size=-1]    |[size=1]       
10  |#22:270|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|hiking                   |false  |[size=-1]    |[size=1]       
11  |#22:249|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|lgbt-friendly            |false  |[size=-1]    |[size=1]       
12  |#22:250|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|mountain                 |false  |[size=-1]    |[size=1]       
13  |#22:239|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|non-smoking rooms        |false  |[size=-1]    |[size=1]       
14  |#22:240|Concept|2015-01-13 09:36:20|2015-01-12 11:10:17|parking                  |false  |[size=-1]    |[size=2]       
15  |#22:251|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|pet-friendly             |false  |[size=-1]    |[size=1]       
16  |#22:241|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|pool                     |false  |[size=-1]    |[size=1]       
17  |#22:242|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|spa                      |false  |[size=-1]    |[size=1]       
18  |#22:277|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|stately                  |false  |[size=-1]    |[size=1]       
19  |#22:253|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|weddings                 |false  |[size=-1]    |[size=1]       
----+-------+-------+-------------------+-------------------+-------------------------+-------+-------------+---------------

20 item(s) found. Query executed in 0.298 sec(s).



orientdb {db=test}> select expand(out("hasConcept").@rid) from Attraction where name = "Hotel ABC" limit 1000

----+-------+-------+-------------------+-------------------+-------------------------+-------+-------------+---------------
#   |@RID   |@CLASS |updatedAt          |createdAt          |name                     |archive|in_hasConcept|out_hasCategory
----+-------+-------+-------------------+-------------------+-------------------------+-------+-------------+---------------
0   |#22:234|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|air conditioning         |false  |[size=-1]    |[size=1]       
1   |#22:266|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|biking                   |false  |[size=-1]    |[size=1]       
2   |#22:235|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|business                 |false  |[size=-1]    |[size=1]       
3   |#22:236|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|city                     |false  |[size=-1]    |[size=1]       
4   |#22:245|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|eco-friendly             |false  |[size=-1]    |[size=1]       
5   |#22:255|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|fishing                  |false  |[size=-1]    |[size=1]       
6   |#22:237|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|fitness facilities       |false  |[size=-1]    |[size=1]       
7   |#22:247|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|food and wine            |false  |[size=-1]    |[size=1]       
8   |#22:256|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|handicap accessible rooms|false  |[size=-1]    |[size=1]       
9   |#22:238|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|high-speed internet      |false  |[size=-1]    |[size=1]       
10  |#22:270|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|hiking                   |false  |[size=-1]    |[size=1]       
11  |#22:249|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|lgbt-friendly            |false  |[size=-1]    |[size=1]       
12  |#22:250|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|mountain                 |false  |[size=-1]    |[size=1]       
13  |#22:239|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|non-smoking rooms        |false  |[size=-1]    |[size=1]       
14  |#22:240|Concept|2015-01-13 09:36:20|2015-01-12 11:10:17|parking                  |false  |[size=-1]    |[size=2]       
15  |#22:251|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|pet-friendly             |false  |[size=-1]    |[size=1]       
16  |#22:241|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|pool                     |false  |[size=-1]    |[size=1]       
17  |#22:242|Concept|2015-01-12 11:12:46|2015-01-12 11:10:17|spa                      |false  |[size=-1]    |[size=1]       
18  |#22:277|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|stately                  |false  |[size=-1]    |[size=1]       
19  |#22:253|Concept|2015-01-12 11:12:46|2015-01-12 11:10:18|weddings                 |false  |[size=-1]    |[size=1]       
----+-------+-------+-------------------+-------------------+-------------------------+-------+-------------+---------------

20 item(s) found. Query executed in 0.002 sec(s).



orientdb {db=test}> select expand(out("hasConcept").name) from Attraction where name = "Hotel ABC" limit 1000

----+------+-------------------------
#   |@CLASS|value                    
----+------+-------------------------
0   |null  |air conditioning         
1   |null  |biking                   
2   |null  |business                 
3   |null  |city                     
4   |null  |eco-friendly             
5   |null  |fishing                  
6   |null  |fitness facilities       
7   |null  |food and wine            
8   |null  |handicap accessible rooms
9   |null  |high-speed internet      
10  |null  |hiking                   
11  |null  |lgbt-friendly            
12  |null  |mountain                 
13  |null  |non-smoking rooms        
14  |null  |parking                  
15  |null  |pet-friendly             
16  |null  |pool                     
17  |null  |spa                      
18  |null  |stately                  
19  |null  |weddings                 
----+------+-------------------------

20 item(s) found. Query executed in 0.002 sec(s).
@lvca
Copy link
Member

lvca commented Jan 14, 2015

Seems your record have many edges, so unmarshalling the entire record could be very expensive. How many edges have the records? Let's say record #22:234, #22:266 and #22:235?

@lvca lvca self-assigned this Jan 14, 2015
@brandonburkett
Copy link
Author

You are correct, we have lots of edges and this will be growing.

#22:234 has 532 edges
#22:266 has 219 edges
#22:235 has 348 edges

@lvca
Copy link
Member

lvca commented Jan 14, 2015

So I'm closing this issue. You discovered a best practice to keep memory lower ;-)

@lvca lvca closed this as completed Jan 14, 2015
@vitorenesduarte
Copy link
Contributor

This consumes less memory in all cases?
Can't it be like this by default?

@lvca
Copy link
Member

lvca commented Jan 14, 2015

@devourment77 Could you share your db so I can do some tests to understand if @vitorenesduarte is right about changing default behavior?

@vitorenesduarte
Copy link
Contributor

@lvca any progress here?

@lvca
Copy link
Member

lvca commented Apr 15, 2015

@vitorenesduarte I haven't received any response from @devourment77. I'd like to have a db where I can debug why there is so much difference

@lvca lvca reopened this Apr 15, 2015
@vitorenesduarte
Copy link
Contributor

I've created a dummy database with this but the times of both queries are very alike so far.

@lvca
Copy link
Member

lvca commented Apr 17, 2015

I found a bug thanks to your code: the fetchplan fetches more than it should by loading many unnecessary records.

@vitorenesduarte
Copy link
Contributor

Do you mean with Java API?
I have queries that in console with fetchplan *:-2 take less time than with Java API.
I couldn't understand why.
Hope that the problem was this one you found.

@lvca
Copy link
Member

lvca commented Apr 17, 2015

The problem seems exactly this: no error but slowness because all not necessary loads. Fixing this in 2.0.8 and 2.1-rc2

@lvca lvca added this to the 2.0.8 milestone Apr 17, 2015
@brandonburkett
Copy link
Author

Apologies for not getting back on this topic and thank you @vitorenesduarte and @lvca for looking into the issue further.

@lvca lvca modified the milestones: 2.0.8, 2.0.9 Apr 17, 2015
lvca added a commit that referenced this issue Apr 18, 2015
@lvca
Copy link
Member

lvca commented Apr 18, 2015

The problem was only in console: fetchplan *:1 was used by default instead of *:0.

@lvca lvca closed this as completed Apr 18, 2015
lvca added a commit that referenced this issue Apr 18, 2015
@lvca lvca removed this from the 2.0.9 milestone Apr 22, 2015
@lvca lvca modified the milestones: 2.0.8, 2.0.9 Apr 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants