From 587f7d16a5cdac16a6434f7372fbdf76b7ec6dd7 Mon Sep 17 00:00:00 2001 From: Martin Goik <goik@hdm-stuttgart.de> Date: Fri, 9 Jan 2015 09:53:49 +0100 Subject: [PATCH] Cache related exercise --- Sda2/Ref/Fig/jpacache.svg | 106 +++++++++++++++++++++++++++++++++++--- Sda2/sda2.xml | 46 ++++++++++++----- 2 files changed, 131 insertions(+), 21 deletions(-) diff --git a/Sda2/Ref/Fig/jpacache.svg b/Sda2/Ref/Fig/jpacache.svg index 66e029d1f..bc8e7e029 100644 --- a/Sda2/Ref/Fig/jpacache.svg +++ b/Sda2/Ref/Fig/jpacache.svg @@ -25,10 +25,10 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="1.3828889" - inkscape:cx="526.18109" + inkscape:cx="523.67507" inkscape:cy="372.04724" inkscape:document-units="px" - inkscape:current-layer="layer15" + inkscape:current-layer="layer16" showgrid="true" inkscape:window-width="1920" inkscape:window-height="1176" @@ -3492,7 +3492,7 @@ inkscape:groupmode="layer" id="layer15" inkscape:label="Invalidation" - style="display:inline"> + style="display:none"> <text xml:space="preserve" style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;display:inline;font-family:Sans" @@ -3568,19 +3568,111 @@ id="text5012" y="503.29422" x="214.76781" - style="font-size:28px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:125%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:sans;-inkscape-font-specification:sans" + style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:125%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:sans;-inkscape-font-specification:sans" xml:space="preserve"><tspan y="503.29422" x="214.76781" id="tspan5014" sodipodi:role="line" - style="-inkscape-font-specification:Sans;font-family:Sans">Ehcache <tspan - style="fill:#0000ff;-inkscape-font-specification:Sans;font-family:Sans" + style="font-size:36px;font-family:Sans;-inkscape-font-specification:Sans">Ehcache <tspan + style="font-size:36px;fill:#0000ff;font-family:Sans;-inkscape-font-specification:Sans" id="tspan5020">Cache Eviction Algorithms</tspan></tspan></text> </a> </g> <g - style="display:none" + inkscape:groupmode="layer" + id="layer16" + inkscape:label="Configure Invalidation" + style="display:none"> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;display:inline;font-family:Sans" + x="10" + y="44.094482" + id="text3278-3-4-0-8-1-9-7-3-3-9" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3280-5-4-5-5-2-9-9-2-6-5" + x="10" + y="44.094482">Configure Invalidation / ehcache.xml</tspan></text> + <text + xml:space="preserve" + style="font-size:28px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:125%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Monospace;-inkscape-font-specification:Monospace" + x="0" + y="104.09448" + id="text5056" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan5058" + x="0" + y="104.09448"><ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"</tspan><tspan + sodipodi:role="line" + x="0" + y="139.09448" + id="tspan5060"> xsi:noNamespaceSchemaLocation="ehcache.xsd"></tspan><tspan + sodipodi:role="line" + x="0" + y="174.09448" + id="tspan5062"> </tspan><tspan + sodipodi:role="line" + x="0" + y="209.09448" + id="tspan5064"> <diskStore path="/tmp/ehcache"/> </tspan><tspan + sodipodi:role="line" + x="0" + y="244.09448" + id="tspan5066"> </tspan><tspan + sodipodi:role="line" + x="0" + y="279.09448" + id="tspan5068"> <defaultCache maxElementsInMemory="10000"</tspan><tspan + sodipodi:role="line" + x="0" + y="314.09448" + id="tspan5070"> eternal="false"</tspan><tspan + sodipodi:role="line" + x="0" + y="349.09448" + id="tspan5072"> timeToIdleSeconds="300"</tspan><tspan + sodipodi:role="line" + x="0" + y="384.09448" + id="tspan5074"> timeToLiveSeconds="600"</tspan><tspan + sodipodi:role="line" + x="0" + y="419.09448" + id="tspan5076"> diskSpoolBufferSizeMB="30"</tspan><tspan + sodipodi:role="line" + x="0" + y="454.09448" + id="tspan5078"> maxElementsOnDisk="10000"</tspan><tspan + sodipodi:role="line" + x="0" + y="489.09448" + id="tspan5080"> diskExpiryThreadIntervalSeconds="120"</tspan><tspan + sodipodi:role="line" + x="0" + y="524.09448" + id="tspan5082"> memoryStoreEvictionPolicy="LRU"</tspan><tspan + sodipodi:role="line" + x="0" + y="559.09448" + id="tspan5084"> </tspan><tspan + sodipodi:role="line" + x="0" + y="594.09448" + id="tspan5086"> statistics="true"></tspan><tspan + sodipodi:role="line" + x="0" + y="629.09448" + id="tspan5088"> </defaultCache></tspan><tspan + sodipodi:role="line" + x="0" + y="664.09448" + id="tspan5090"> ...</tspan></text> + </g> + <g + style="display:inline" inkscape:label="Helpful links" id="layer5" inkscape:groupmode="layer"> diff --git a/Sda2/sda2.xml b/Sda2/sda2.xml index 8d6f11bfa..c1afb053a 100644 --- a/Sda2/sda2.xml +++ b/Sda2/sda2.xml @@ -3778,16 +3778,6 @@ </qandaset> </section> </section> - - <section xml:id="mappingEntities"> - <title>Mapping entities</title> - - <section xml:id="mappingOneToOne"> - <title/> - - <para/> - </section> - </section> </section> <section xml:id="cache"> @@ -3795,12 +3785,40 @@ <para>Introductory <link xlink:href="Ref/Fig/jpacache.svg">slide presentation</link>.</para> - </section> - <section xml:id="sect_hibernateValidation"> - <title>Hibernate validation</title> + <qandaset defaultlabel="qanda" xml:id="cacheTesting"> + <title>Testing caches</title> + + <qandadiv> + <qandaentry> + <question> + <para>Import the following Hibernate based project:</para> - <para/> + <annotation role="make"> + <para role="eclipse">P/Jpa/HibernateCacheDemo</para> + </annotation> + + <orderedlist> + <listitem> + <para>Insert 10000 randomly generated + <classname>Person</classname> entries into your + database.</para> + </listitem> + + <listitem> + <para>Measure time differences for loading 1000 entities in + different sessions.</para> + </listitem> + + <listitem> + <para>Measure time differences for attribute based queries + both with query cache enabled and disabled.</para> + </listitem> + </orderedlist> + </question> + </qandaentry> + </qandadiv> + </qandaset> </section> <section xml:id="orphanRemoval"> -- GitLab