Re: performance issues

Thomas Buffagni <[email protected]> Wed, 20 Dec 2006 09:30:15 +0100
Newsgroups gmane.comp.java.enhydra.shark
Message-ID <[email protected]>
This is a multi-part message in MIME format...

------------=_1166603482-5041-23
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Sasa Bojanic,<br>
I'm curious to know what is the execution time of the same code below
with the latest version of shark...Does anybody have made some tests&nbsp; ?
- Thomas.<br>
<br>
Sasa Bojanic ha scritto:
<blockquote cite="[email protected]" type="cite">Hi,
  <br>
  <br>
I made some tests on Shark2.0-beta7 using MySQL database.
  <br>
  <br>
Here is the code snippet:
  <br>
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long t1, t2, t3;
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t1 = System.currentTimeMillis();
  <br>
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ut.begin();
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WfAssignment[] ass =
sc.getResourceObject().get_sequence_work_item(0);
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ut.commit();
  <br>
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t2 = System.currentTimeMillis();
  <br>
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; ass.length; i++) {
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long ti = System.currentTimeMillis();
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ut.begin();
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WfAssignment as = ass[i];
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WfActivity act = as.activity();
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; act.key();
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; act.name();
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WfProcess proc = act.container();
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proc.name();
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
am.getProcessDefinitionInfoByUniqueProcessDefinitionName(sc.getSessionHandle(),
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
proc.manager()
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.name());
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; am.getProcessCreatedTime(sc.getSessionHandle(), proc.key());
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; am.getActivityCreatedTime(sc.getSessionHandle(), proc.key(),
act.key());
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DeadlineInfo[] difo =
am.getDeadlineInfoForActivity(sc.getSessionHandle(),
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
proc.key(),
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
act.key());
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ut.commit();
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long te = System.currentTimeMillis();
  <br>
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("Assignment no. "
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + (i + 1) + ": act=" + act.key() + ",
exec lasted "
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + (te - ti) + " ms");
  <br>
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t3 = System.currentTimeMillis();
  <br>
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("Overal exec lasted "
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + (t3 - t1) + " ms, midTime=" + (t2 - t1) +
" ms, avgTime="
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + (t3 - t2) / ass.length + " ms");
  <br>
  <br>
  <br>
And here is the output:
  <br>
  <br>
Assignment no. 1:
act=269_24_deadline_examples_do_something_do_something2, exec lasted 31
ms
  <br>
Assignment no. 2:
act=21_16_workflow_patterns_WfSP2_Implicit_Termination_A, exec lasted
16 ms
  <br>
Assignment no. 3:
act=261_8_workflow_patterns_WfBCP4_Exclusive_Choice_B, exec lasted 31
ms
  <br>
Assignment no. 4: act=8_7_workflow_patterns_WfBCP3_Synchronization_A,
exec lasted 31 ms
  <br>
Assignment no. 5:
act=22_17_workflow_patterns_WfPIMI1_MI_without_synchronization_A, exec
lasted 16 ms
  <br>
Assignment no. 6:
act=263_21_deadline_examples_several_async_and_one_sync_deadline_see_log,
exec lasted 31 ms
  <br>
Assignment no. 7: act=271_2_test_js_manufacturing_produce_part2, exec
lasted 32 ms
  <br>
Assignment no. 8: act=1_1_test_js_basic_A1, exec lasted 31 ms
  <br>
Assignment no. 9: act=16_13_workflow_patterns_WfABSP4_Discriminator_A,
exec lasted 15 ms
  <br>
Assignment no. 10:
act=25_20_deadline_examples_simple_async_and_sync_deadline_do_something,
exec lasted 47 ms
  <br>
Assignment no. 11: act=31_25_test_js_mail_handling_enter_parameters,
exec lasted 32 ms
  <br>
Assignment no. 12:
act=20_15_workflow_patterns_WfSP1_Arbitrary_Cycles_A, exec lasted 15 ms
  <br>
Assignment no. 13:
act=11_10_workflow_patterns_WfABSP1_Multiple_Choice_A, exec lasted 16
ms
  <br>
Assignment no. 14: act=6_5_workflow_patterns_WfBCP1_Sequence_A, exec
lasted 31 ms
  <br>
Assignment no. 15:
act=28_22_deadline_examples_block_sync_deadline_do_something1, exec
lasted 16 ms
  <br>
Assignment no. 16: act=270_2_test_js_manufacturing_produce_part1, exec
lasted 15 ms
  <br>
Assignment no. 17: act=7_6_workflow_patterns_WfBCP2_Parallel_Split_A,
exec lasted 47 ms
  <br>
Assignment no. 18: act=5_4_test_js_publish_doc_submit_document, exec
lasted 16 ms
  <br>
Assignment no. 19: act=3_3_test_js_specrelease_specification, exec
lasted 47 ms
  <br>
Assignment no. 20:
act=12_11_workflow_patterns_WfABSP2_Synchronizing_Merge_A, exec lasted
15 ms
  <br>
Assignment no. 21:
act=23_18_workflow_patterns_WfPIMI2_MI_with_a_priori_known_design_time_knowledge_A,
exec lasted 16 ms
  <br>
Assignment no. 22:
act=19_14_workflow_patterns_WfABSP5_N_out_of_M_Join_A, exec lasted 31
ms
  <br>
Assignment no. 23: act=10_9_workflow_patterns_WfBCP5_Simple_Merge_A,
exec lasted 16 ms
  <br>
Assignment no. 24:
act=13_12_workflow_patterns_WfABSP3_Multiple_Merge_A, exec lasted 31 ms
  <br>
Assignment no. 25:
act=24_19_deadline_examples_simple_sync_deadline_do_something, exec
lasted 31 ms
  <br>
Overal exec lasted 703 ms, midTime=47 ms, avgTime=26 ms
  <br>
  <br>
  <br>
As you can see, the average time for getting requested information is
26ms per assignment which I think is good enough.
  <br>
  <br>
I assume you are using Shark1.1 version? If so, it can greatly improve
performance if you turn-off Security API&nbsp; (by commenting appropriate
line in Shark.conf).
  <br>
The greatest improvement would be if you would do your queries using
single SharkTransaction (in your example there are more than 10
transactions implicitly created). In Shark1.1 it would be something
like:
  <br>
  <br>
SharkTransaction st=null;
  <br>
try {
  <br>
&nbsp;st=Shark.getInstance().createTransaction();
  <br>
&nbsp;WfActivity activity = assignment.activity(st);
  <br>
&nbsp;activity.key(st);
  <br>
&nbsp;activity.name(st);
  <br>
&nbsp;WfProcess process = activity.container(st);
  <br>
&nbsp;process.name(st);
  <br>
&nbsp;adminMisc.getProcessMgrPkgId(st,process.manager(st).name(st));
  <br>
&nbsp;adminMisc.getProcessCreatedTime(st,process.key(st));
  <br>
&nbsp;adminMisc.getActivityCreatedTime(st,process.key(st),activity.key(st));
  <br>
&nbsp;DeadlineInfo[] deadlineInfos =
deadlineAdministration.getDeadlineInfo(st,process.key(st),
activity.key(st));
  <br>
  <br>
} catch (Exception ex) {
  <br>
&nbsp;Shark.getInstance().emptyCaches();
  <br>
} finally {
  <br>
&nbsp;try {
  <br>
&nbsp;&nbsp; st.release();
  <br>
&nbsp;} catch (Exception ex) {}
  <br>
&nbsp;&nbsp; try {
  <br>
&nbsp;&nbsp;&nbsp;&nbsp; Shark.getInstance().unlockProcesses(st);
  <br>
&nbsp;&nbsp; } catch (Exception ex) {}
  <br>
}
  <br>
  <br>
Greetings,
  <br>
Sasa.
  <br>
  <br>
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a> wrote:
  <br>
  <blockquote type="cite">I am facing the problem of very slow response
from shark when getting information about process and activities.
    <br>
    <br>
my code is:
    <br>
    <br>
WfAssignment
assignment=connection.getResourceObject().get_sequence_work_item(0);
    <br>
    <br>
WfActivity activity = assignment.activity();
    <br>
activity.key());
    <br>
activity.name());
    <br>
WfProcess process = activity.container();
    <br>
process.name());
    <br>
adminMisc.getProcessMgrPkgId(process.manager().name()));
    <br>
adminMisc.getProcessCreatedTime(process.key())));
    <br>
adminMisc.getActivityCreatedTime(process.key(),activity.key())));
    <br>
DeadlineInfo[] deadlineInfos =
deadlineAdministration.getDeadlineInfo(process.key(), activity.key());
    <br>
    <br>
    <br>
this part of code takes about 545 Milli seconds each time i call that
code.
    <br>
in fact i need to call that code for each activity assigned to a user,
so for example if the user have 20 activities approximately the time
taken in getting those information is about 10 seconds for each user
which is not acceptable at all so am asking if their is a way to
enhance the performance of that code or any sort of shark configuration
available to enhance the shark performance.
    <br>
    <br>
regards Ramy
    <br>
    <br>
&nbsp;
------------------------------------------------------------------------
    <br>
    <br>
    <br>
--
    <br>
You receive this message as a subscriber of the <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
mailing list.
    <br>
To unsubscribe: <a class="moz-txt-link-freetext" href="mailto:[email protected]">mailto:[email protected]</a>
    <br>
For general help: <a class="moz-txt-link-freetext" href="mailto:[email protected]?subject=help">mailto:[email protected]?subject=help</a>
    <br>
ObjectWeb mailing lists service home page: <a class="moz-txt-link-freetext" href="http://www.objectweb.org/wws">http://www.objectweb.org/wws</a>
    <br>
&nbsp; </blockquote>
  <br>
  <br>
  <pre wrap="">
<hr size="4" width="90%">

--
You receive this message as a subscriber of the <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a> mailing list.
To unsubscribe: <a class="moz-txt-link-freetext" href="mailto:[email protected]">mailto:[email protected]</a>
For general help: <a class="moz-txt-link-freetext" href="mailto:[email protected]?subject=help">mailto:[email protected]?subject=help</a>
ObjectWeb mailing lists service home page: <a class="moz-txt-link-freetext" href="http://www.objectweb.org/wws">http://www.objectweb.org/wws</a>
  </pre>
</blockquote>
<br>
</body>
</html>


------------=_1166603482-5041-23
Content-Type: text/plain; name="message-footer.txt"
Content-Disposition: inline; filename="message-footer.txt"
Content-Transfer-Encoding: 8bit


--
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

------------=_1166603482-5041-23--