Hi,
15 seconds is crazy. I didn't analyze all the code, but I've 2 questions
and 2 tips to speed up:
1. Do you open/close a graph for each items? Can you use always the
same? I mean open at the beginning and close at the end
2. Have you profiled where most of the time is spent?
Few tips:
Don't get the indexes everytime, but store them in the class field at the
beginning and then you can avoid this lines everytime (for all the indexes):
OIndexManager idxManager =
graph.getRawGraph().getMetadata().getIndexManager();
OIndex<?> idx = idxManager.getIndex(INDEX_CONSTANTS.FB_COMPANY_ID_INDEX);
Then, remove the traverse if the level is only 1, from:
select from (traverse V.out, E.in from "+node1.getIdentity()+" while $depth
<=1) where @class='Friends' and in=?
to:
select out('Friend') from "+node1.getIdentity()
Lvc@
On 22 May 2014 14:17, Pawan Goyal <[email protected]> wrote:
> I am trying to store a facebook user data into orientDB .its taking 10-15
> seconds for user for
>
> storing user,his friends and friends company into orientDB.
>
> Sample code is given below
>
> public void testMigration() throws Exception {
> long t1 = System.currentTimeMillis();
> int j=0;
> DBObject dbObject=mongoDao.getUserProfileByProfileID("1034443849",
> "jbz");
> long t2 = System.currentTimeMillis();
> final String pid = (String) dbObject.get("pid");
> final String apc = (String) dbObject.get("apc");
> logger.info("pid=" + pid + " apc=" + apc + "===== "
> + j++);
> logger.info("[OPT]starting to handleNetworkUpdate(async)...");
> try {
>
> networkDiscoveryFacade.addFacebookUserDataIntoGraphDb(pid,
> apc);
> logger.info("[OPT]addFacebookUserDataIntoGraphDb done");
> networkDiscoveryFacade
> .addFacebookUserFriendsDataIntoGraphDb(pid);
> logger.info("[OPT]addFacebookUserFriendsDataIntoGraphDb
> done");
> //mongoDao.updateProfileMigrationStatus(pid, apc, "1");
> System.out.println("Total time: " +pid +" "+
> (System.currentTimeMillis() - t2));
> logger.info("[OPT]updateProfileMigrationStatus done");
> } catch (Exception e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> logger.info("[OPT]returning from
> handleNetworkUpdate(async)...");
>
> System.out.println("Total time: " + (System.currentTimeMillis() -
> t1));
> System.out.println("done");
>
> i have attached the code.
>
>
>
>
>
> }
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OrientDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.