Vous êtes sur la page 1sur 179

Optimisation des applications web dynamiques

pour les besoins du commerce électronique : cas


particulier de Java et MySQL

En hommage à Abu Abdullah Mohammad Ibn Musa al-Khawarizmi

Kamal AOUDA, Publishing


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Sommaire

1. PRÉSENTATION 7

1.1 PROBLÉMATIQUE DE L’ESSAI 7


1.2 OBJECTIF DE L’ESSAI 10
1.3 PÉRIMÈTRE DE L’ESSAI 12
1.4 MÉTHODOLOGIE ADOPTÉE 12
1.5 RÉSULTATS ESCOMPTÉS 14

2. LA PERFORMANCE DANS LE CONTEXTE DU COMMERCE ÉLECTRONIQUE 15

2.1 LA PERFORMANCE TELLE QUE PERÇUE PAR LES UTILISATEURS ET LES MANAGERS 15
2.1.1 LE TEMPS DE RÉPONSE 15
2.1.1.1 Benchmark pour les transactions E-commerce (Keynote E-Commerce Index) 18
2.1.1.2 Benchmark pour les transactions bancaires 19
2.1.1.3 Benchmark pour les connexions à 56 Kbps 20
2.1.1.4 Benchmarks sectoriels 20
2.1.2 LE DÉBIT 21
2.2 LA PERFORMANCE TELLE QUE PERÇUE PAR L’ÉQUIPE DE DÉVELOPPEMENT 25
2.2.1 SEGMENTATION DU TEMPS DE RÉPONSE EN FONCTION DES COMPOSANTS 25
2.2.1.1 Injection d’un compteur dans le code source (Custom Instrumentation) 25
2.2.1.2 Utilisation d’un profiler 35
2.2.2 MESURE DE LA CHARGE DE TRAVAIL EN FONCTION DU COMPORTEMENT DES VISITEURS 40
2.2.3 MESURE DU DÉBIT ET DES COÛTS Y AFFÉRENTS (BENCHMARK TPC-W) 42

3. GESTION DE LA PERFORMANCE DANS LA PHASE D’ANALYSE 52

3.1 BESOINS EN PERFORMANCE ET MODELES D’AFFAIRES 53


3.1.1 BESOINS EN PERFORMANCE DES SITES B2C 53
3.1.2 BESOINS EN PERFORMANCE DES SITES B2B 56
3.1.3 BESOINS EN PERFORMANCE DES SITES C2C (ONLINE AUCTIONS) 57
3.2 SPECIFICATION DES BESOINS EN PERFORMANCE DANS LE CAHIER DES CHARGES 58
3.2.1 L’ESSENTIEL SUR LES PROFILS UML 59
3.2.2 L’ESSENTIEL SUR LE UML PROFILE FOR SCHEDULABILITY, PERFORMANCE, AND TIME 62

4. GESTION DE LA PERFORMANCE DANS LA PHASE DE DESIGN 69

4.1 IMPACT DE L’ARCHITECTURE DE L’APPLICATION SUR LES PERFORMANCES 69


4.1.1 ARCHITECTURE MODEL 1 69
4.1.2 ARCHITECTURE MODEL 2 71
4.2 IMPACT DU DESIGN DES COMPOSANTS SUR LES PERFORMANCES 74
4.2.1 ANTI-PATTERNS ET PATTERNS DE LA COUCHE DE PRESENTATION 74
4.2.1.1 Les vues composites 74
4.2.1.2 La gestion des sessions au niveau de la couche de présentation 76
4.2.1.3 La validation des données au niveau de la couche de présentation 80

©Kamal AOUDA 2005 www.kamalaouda.com Page 2 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

4.2.2 ANTI-PATTERNS ET PATTERNS DE LA COUCHE DE CONTROLE 82


4.2.2.1 Quel objet utiliser pour implémenter le contrôleur ? 82
4.2.2.2 Stratégies pour la gestion du cache 82
4.2.2.3 Compression des paquets http au niveau des filtres 86
4.2.2.4 Pooling des ressources 88
4.2.3 ANTI-PATTERNS ET PATTERNS DE LA COUCHE D’AFFAIRES 90
4.2.3.1 A propos de la performance des EJB 90
4.2.3.2 Gestion des sessions au niveau de la couche d’affaires 93
4.2.3.3 Les apports des communications asynchrones 93
4.2.3.4 Transformation des invocations distantes en appels locaux 94
4.2.3.5 BMP vs CMP 96
4.2.3.6 Entity façade 96

5. GESTION DE LA PERFORMANCE DANS LA PHASE DE CODAGE 99

5.1 OPTIMISATION DES PRINCIPAUX COMPOSANTS J2SE 99


5.1.1 LES CHAINES DE CARACTERES 99
5.1.1.1 Concaténation des objets String 99
5.1.1.2 Comparaison des chaînes de caractères 102
5.1.1.3 StringTokenizer 104
5.1.1.4 Tri des chaînes internationalisées 105
5.1.2 CREATION/ REUTILISATION/ IMPORTATION D’OBJETS 107
5.1.2.1 Création prématurée d’objets 107
5.1.2.2 Réutilisation des objets 107
5.1.2.3 Importation des classes 109
5.1.3 BOUCLES FOR 109
5.1.3.1 Quel type d’indice utiliser avec les boucles for ? 109
5.1.3.2 Appel de méthodes dans les paramètres d’une boucle for 109
5.1.3.3 System.arraycopy( ) vs boucle for 110
5.1.3.4 Générer une exception pour mettre fin à une boucle for 111
5.1.4 COLLECTIONS JAVA 2 111
5.1.4.1 Comparatif des performances 111
5.1.4.2 Impact de l’emplacement des éléments d’une collection sur la performance 115
5.1.4.3 Capacité d’une collection 115
5.1.5 GESTION DES EXCEPTIONS 116
5.1.5.1 Impact des blocs try/ catch qui ne génèrent pas d’exceptions 116
5.1.5.2 Impact des blocs try/ catch qui génèrent des exceptions 117
5.1.6 CASTING 117
5.1.7 PASSAGE DES PARAMETRES, PROPRIETES STATIQUES, PROPRIETES D’INSTANCES 118
5.1.8 FICHIERS JAR 118
5.1.9 CACHING DES APPLETS 119
5.2 OPTIMISATION DES PRINCIPAUX COMPOSANTS J2EE 120
5.2.1 OPTIMISATION DES SERVLETS ET DES JSP 120
5.2.1.1 Se méfier des objets PrintWriter 120
5.2.1.2 Eviter l’implémentation de l’interface SingleThreadModel 121
5.2.1.3 Implémenter un filtre de cache 122
5.2.1.4 Gérer le cache via la méthode init() de la classe HttpServlet 127
5.2.1.5 Contrôler la progression des objets HttpSession 128
5.2.1.6 Désactiver le chargement automatique des servlets/JSP 129
5.2.1.7 Compression des réponses 130

©Kamal AOUDA 2005 www.kamalaouda.com Page 3 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

5.2.1.8 Include directive vs include action 131


5.2.1.9 Minimiser la portée des Java Beans 131
5.2.1.10 Redirects Versus Forwards 132
5.2.1.11 Précompilation des servlets/JSP 132
5.2.1.12 Tags OSCache 132
5.2.2 OPTIMISATION DES ENTERPRISE JAVA BEANS 135
5.2.2.1 Appels distants, EJB 1.1 vs EJB2.0 135
5.2.2.2 Mettre en cache les objets retournés par les lookup JNDI 136
5.2.2.3 Impact du niveau d’isolation des transactions sur les performances 137
5.2.2.4 Accéder aux entity beans par l’entremise d’un session bean 141
5.2.3 OPTIMISATION DE JDBC 142
5.2.3.1 Choix du driver 142
5.2.3.2 Connection pooling 145
5.2.3.3 Procédures stockées 151
5.2.3.4 Prepared Statement 152
5.3 OPTIMISATION DE MYSQL 153
5.3.1 PERFORMANCE DES MOTEURS DE STOCKAGE 153
5.3.2 VERROUILLAGE, CONCURRENTIALITE ET PERFORMANCE 156
5.3.3 LES INDEXES 157
5.3.4 CONCORDANCES ENTRE LES TYPES DE DONNEES 160
5.3.5 LES PROCEDURES STOCKEES 160
5.3.6 OPTIMISATION DES REQUETES 162
5.3.6.1 Rendre les requêtes SELECT … WHERE plus rapides 162
5.3.6.2 Performance des requêtes SELECT et ordre des jointures 162
5.3.6.3 Query cache 163

6. CONCLUSION 165

7. REVUE DE LA LITTÉRATURE PERTINENTE 166

8. ANNEXES 171

ANNEXE 1: LISTE EXHAUSTIVE DES PROFILS UML 172


ANNEXE 2: STEREOTYPES ET ETIQUETTES DU SOUS-PROFIL PERFORMANCE 173
ANNEXE 3: TABLES DE CORRESPONDANCE ENTRE LES TYPES DE DONNEES DE MYSQL VS
JAVA VS JDBC 175

LISTE DES FIGURES 177

LISTE DES TABLEAUX 179

©Kamal AOUDA 2005 www.kamalaouda.com Page 4 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

A propos de l’auteur de ce livre

   
              
   
               
               
       !           
          "         
      # $ % &   ' ( 

%  
     !  )           "       
      *     
     +                     
            ,        
   " -             
      "   .       /     
              
    
    "                    
         !     0      
    1 

•   1 2 2 # # # ,   2         
   

•   1 2 2 # # # ,   2  3          


©Kamal AOUDA 2005 www.kamalaouda.com Page 5 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Conditions d’utilisation

4  5     "                      
5      "       ! 

       

6         7     !   
,  8 ,    9        "      
  :    !          
 

'  5                     !   
  1 2 2 # # # ,   2  3   !   &   & ; ; 

             

©Kamal AOUDA 2005 www.kamalaouda.com Page 6 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

1. Présentation
1.1 Problématique de l’essai
  
  


 
 ! #"$ %'&  (! # ) ! (*+ ) ",   -
. ! / 


102
234
 / 5 5!6 07/
    + 
  . 8:9",!  ; .
 <*+ ( >=.*( "?
@ 
A! ;=>=#
"B . C 
5D

  ",  ,EFG",*1*+#",G  
"H .
 @  I(JK*4*+L C*(? #L 
5
  M3 &-"!N  ,  C*(

< GN  =>=. # PO0J @ 
A!. / Q
 R 5"$ Q!"? S 5 . 
 ?!!    *+! T
U  V!
"H . .VW X
 
  ",  UY  Z &[W N  ! .)*+    
=)  " <#&?\ 5
) *+1 ^] _
ZI

Tableau 1: Répartition par secteurs d’activité des pertes potentielles dues aux problèmes de
4
performance affectant les applications de commerce électronique de type B2C

`
 ",
F5  "
   

  ",  F *1
 *+! .
 9: N  a  .
"$
 
Z  b! ]c*+ ) 5
[
N d #R?
 ] I^efg=h=# )&i
D.
> -N jhkKJU ? #"$g ,  *+ @  l*( !TR02mn 
`


  ",  Ho-b!0eeD)) ] ! p9q?  H=. #r  [H 5 .
[r >=.)*( "?I  :# 5*1
 
=)  " <# \??  !*+ +

  @  s

1
Source: Zona Research, Need for speed 2, http://www.keynote.com/downloads/Zona_Need_For_Speed.pdf
2
Cette perte est évaluée en termes de manque à gagner c’est à dire en calculant le montant des revenus qui auraient pu
être acquis si ces problèmes avaient été évités.
3
Source: Ethan Henry, Brad Micklea, Bridging the Java™ 2, Platform Enterprise Edition (J2EE™) Technology
Performance Gaps, JavaOne 2004
4
Source: Zona Research, Inc., The Economic Impacts of Unacceptable Web-Site Download Speeds,
http://www.webperf.net/info/wp_downloadspeed.pdf, August 2000
5
Dans le reste de ce document les termes site et application seront utilisés de façon interchangeable.

©Kamal AOUDA 2005 www.kamalaouda.com Page 7 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 *(#"$ 4 i .
"$
  Z  ^b!0eeF ,  ]  4
"H #   *+! 940
    \+
  .HtuI
 wyx
7m  z! # ) ! w {5   y7
2
2|!    !. ! Vb?0ee}

v
 N  *1
 *+! 5  [ 
5/*1 
 /  .~)
","5,) ##[ N  ! .. .
   .   H_, .<*+ 
€
 , 5! 5H‚*( ^? ? Z.=h=# ?]  ,€(!>]
 "? \9  
_ƒ.„uI
`
: 5?€cT  #.  …:b! ]q
c  …! ##
) ! [!. i T*+d*+ @  q"? 

†   ‡O
  ":ˆ‰~.! ‹Ši>  -x
2mΠq! ##
) ? 
r D*(D!    . ! \"?
 Z

Z ƒŽI
b!0eeR , ‡] 
:
[H 5
.:[=. .%#(~.a=."H 5c, 5
. ƒ
… #< Fc‘
7mY 
! # ) ! -"  ! . ^  O) ;f => “’#1JK).   %”%'I
JK! . #*+! •9a
 /"._ "?F .Z*+! f#  F  
.
 <*+ 1F >=.*( "??!
   ",
–
 — > #) 

  —9– —*(   —
˜ N  _!&L ™   Z˜ š 

.
Z.*1*(  ( \

  ",   @  N 91 +  ,=>=) , "? - ›#( \_H=."H # 
 *+! 5\

 ]  [ … ?=).
H )"H  . …*( . )    %.6 @ 
• *( > .? ‡q  [*+ > ##:c# ! [q  
$  .Z œa  ;€
"!! .”I .

 € *+! )&   ! #
) ! ;?  .
"?/9[
) ]
  Z 
v
  1? !  1N !  *1 ?  /*( . )    %#EK<  @  N    1?! œ",?=).? .
 19/ 
.
 <*+ 
 >=.)*( "?I8‡. 5 .%5ž‡Ši5  œŠ-.
;"H?=) )*+&
9"?  Ÿ# )& @  N    (=.! 
 
?€ . ¡? !  P  *+   #  S h=.*( "? ¡L‘
7m™ ¡

  ",  Db!0ee
?]   *+!  
  _
  I¢£¤.£
¥
¦ §£¨ ©ª+©«!¬”s

2 m˜ l
.
 <*+ RG >=.*( "?S?? 1g9P D)#
.D",*4*1 ! l  
­
 . . .\ ^

  ",  +~#)# .\N ) Z   $
 *(   ƒŽI

 *+! 02mQ 4
.
 <*+ - >=.)*( "?4?! -9 ; =.    "?;;*( . ) 
 “›#G N   @   (+?(?]
 .
 *+! .%.ouI

6
Source: Segue Software, Inc., ACHIEVING HIGH PERFORMANCE J2EE APPLICATIONS, January 2003
7
Legacy systems
8
Source: Borland White Paper, Maximizing business value by optimizing J2EE™ performance, June 28, 2004
9
Source: Thomas Malvehill, Key Challenges in developing and deploying J2EE applications, July 28, 2003
10
Format, langage ou protocole qui est devenu un standard non pas en raison de son approbation par un organisme de
standardisation mais en raison de sa grande popularité.
11
Source: Borland presentation on Performance management for the J2EE platform,
http://www.pcuf.fi/sytyke/kerhot/javasig/PerfMan_J2EE.pdf
12
Indisponibilité du réseau, serveur avec une mémoire ou un processeur sous- dimensionnés par rapport à la charge de
travail, panne du serveur, sinistres dus à des aléas climatiques…
13
Cela n’est pas sans liens avec la baisse continue des prix du matériel informatique.
14
Teresa Lanowitz, Tearing Down the Wall, Gartner, 2002
15
Température excessive, rupture du courant électrique…

©Kamal AOUDA 2005 www.kamalaouda.com Page 8 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

",! #:®¯°±¥© ²:³


¤.¦´
¨ µª+© ²[¥©r³ ©¤>¶.¦¤ª(£« ·?©:²?¦«!¬i¸ ª1³
¹!¬5£´
¨ © ²[ºq¥© ²[£«¦ª(£¨ ¸ © ²
v
³ ©¤.² ¸ ²,¬5£«!¬.© ²^¥
£«²+¨ ©;¥© ² ¸ »«+© ¬¨ ©;·,¦
¥©4¥© ²\£³
³
¨ ¸ ·,£ ¬¸ ¦«²
¼

  g?€S
#*1 <# g",! ¡
#  
 *+? 1"! .
 g
",
 ! #  
"H  ] *+! 4N 
 
=.*(  ½  ?=>=) ?? .¾½ .?
 Y ¿N 
½*(?] À *+  
 *+! — 
 ?=).
, #) "B 
# D*( . )    
&- l #.   <*+S",!D .?] G
 ? 5Á 4?R) Z  l
S¨ £Q£¨ «¦«
¸ «!¬. »¤.£ ¬¸ ¦«q¥¹‹ª(£«£
»©ª+©«!¬\¥© ²T³ ©¤>¶.¦¤ª(£« ·?© ²cº¡¨ à ©«²!©ª1´
¨ ©r¥© ²r³
Ä£
²!© ²:¥¹r·BÅ ·¨ ©‹¥©
¥ÂÆ ©¨ ¦³
³ ©ª+©«!¬”¼;efG=>=. ",*4*+CS . *( Z ! 
   
.G.
5 5l
F L 5  &1  
 _, . 
&l  Ç."$
 .
"B . ΠQ  n
.
Z.*1*+
.Ç Ç

  ",  È¿",*1*+#"?
 
"H .
 @  / ;  
 ! 
( 5 Ÿ.
.4",*1? .  1  "$
*(ÉB+/ h=.*- "? 
;  

$
! FN  _!&œc
   Z… ‡:",


ZIj“  > .? @  q :",
…, Ê!  <#*+!

") 4
\ . , .(?¡",!" . R9S >=.)*+(
‹
g?]
 .
 *+! -ËD  r",! . ! 5 
N !    ?  
%.tf??  @ 
 ] ! . \91"?   \; N ?]
 .
 *+! #
B;
.  "H  I
`
/#>  *(
Z*+!  ; >=.)*( ", +9 1=) 1;"B_ "    !]  
 *+! *+< 
   ]  .
.9[",, 5 .‚N  *1> 5! 5 
?!*+! 5K.
> ?€
"$  " .
?€r

Z 5
# ]
   
 c 
5 5? \ . @  g g*( $

 
Z TT ]    *+! ^!    !

 )*+ - q‹
:N  . .  ! #R  T
$
? :T . , ”&KN  _!&Kr   ZT i
",


ZI

Ì  ¡". #G
 G
# !! 5  DG CO) G =5 “’#PJK).   %#a  RBŸ), .*+! 5

5 . -?€   ]
.
  -
 ? . 1
$
! (! #.,' 5 ! •
;# #. ;7
2mQ
 (

  ",  
 ͟.9T*1 ! a[!>]
 "?: ‡ F 
?!*+? 5…
!
Z 5 # a ]  F9Î
2mY…",Ï! K 5 5
`
 /
.BŸ# 5!%.„uI N  *1> 5 ",F"? ; 
?!*+! 5Ÿ),  =) [ …
"? ?  . /F"H "?] K  


  ",   F",*1*+."?F  
"H .
 @  
/
 [ .  
"H  ] N !  *1 ?  & "?&< 
  +
#*1 <# +
$ ! \("B_ " 4+ ]  
 *+? )I

16
Utilisation intensive des données et des traitements, accès concurrentiels…

17
Jon Ha Building Quality into developement., Borland softwares,
http://www.java.no/web/moter/javazone03/presentations/JonHarrison/JH_QualityDevelopment_JavaZone.pdf

18
Ces dépassements sont particulièrement importants dans les méthodologies dites séquentielles parce qu’elles
contiennent peu ou pas d’itérations.

©Kamal AOUDA 2005 www.kamalaouda.com Page 9 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Figure 1: Dépassements budgétaires dus au report du management des performances à la fin du


19
cycle de développement

1.2 Objectif de l’essai


J‡ F ?? @ 
\ 5 .ÐC",
Q>  "
  F G 
  ",  GM",*4*+#",M  
"H .
 @  
`
 *1
 *+! .
 :9D N  r c .
"$
 
Z  cb! ]g (Ñ^_ Ò &p
.
!R
‹# !=# #?  

 N  ! . Z.  *(
Z*+! œ  h=.*( "? 4?€ . 
#*1 <# 
$
? ;"B_ " /
 ]  
 *+! ~. _!&!   Z&!",


Z ƒŽI
`
 1 .
"$
 
Z  1b! ]! f . "$       . ? 

*+ #
 ;
 !
"H  …3 I.3
 @ 
Ê! + . 1 ?!?    *+! 4g=.5 ( 5?€DP  .  DS Z

ZS 4g=. 
 

#"?! 5
ZÓ Ô

  ",  Œb!0ee @ 
‹)) ] ! C9˜?  H=. #–  Ô, 5
.
Ô
`
 >=.)*( "?I\Ò(! (‚Š(OkÊTÑ^_ fÒ  B1 . +"$  ?
  (. ?^
 ]! . 4s

19
Source : ACCELERATE YOUR PERFORMANCE, Borland softwares,
http://www.borland.com/optimizeit/pdf/opt6_datasheet.pdf

©Kamal AOUDA 2005 www.kamalaouda.com Page 10 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
Ç
£ »¤.£«¥©Œ³¦³
¹
¨ £¤)¸ ¬.ÂÖ:N 
#< W È?" . ÔÑ^_ Ò Ì O6׏Ø&q"?ȂŠ(OkÊz",*1! .
Õ
 Ÿ.
.N $

?
 \17;*1    \N  , 5    \"H  ]  
I
« ©Ú¹!¬¸ ¨ ¸ ²?£ ¬¸ ¦«Q£·?·¤)¹ ©Q¥
£«²C¥© ²L£³
³
¨ ¸ ·,£ ¬¸ ¦«²PÛi©´Ð²©«² ¸ ´
¨ © ²L£¹?§M³
¤.¦´
¨ µª+© ²G¥©
Ù `
³ ©¤>¶.¦¤”ª(£« ·?©/ÖÑ^_ fÒ  , "B    *+! œ!    ! • 4! ##
) ! ; 5 # 4
4 


  ",  ’iaËc  /


 F Ê   . .*+! 5?? p?    ! F=.Ü,c ! .  ] 
~>] ! .+(  5  &, . 
",*4*1

 ",  
&H=)  "?  &?,! . •ÝFƒ'I
`
Ì  . @  c
… c!
"H .
Ê…",*1*+#"?:  
"H .
 @  &‚Ñ^_ Ò  . .
 *+!
`


! .  ("  ! 54
. ,  Z ?€4",*1*+PÞK$
& _ ",
1ef
. & Ši

Z 1 ’i  N 
v

ÉBH6Ž%'I
Ó¸ «!¬.¤#à ¬œ»¤.£«¥¸ ²?²?£«!¬œ¥©a¨ £a·,¦ª4ª1¹
«£¹!¬.Âá!£ Æ£•Ö=h=# œ
/
?

Za#   ! [
ß `
Ñ _ Ò Ì O‚& 0I ‘mÈ c ]  
 
.:?
$ .! i
?  H .^9R
 =.*(  q 
-  
^
­ `
 ]  
 *+! 5:",*1
 ! Ab! ]‹ -Ñ^_ Ò ~#",! #T0 I ÎmÔ
-  c ]  
 
5
­

 )â  œ3,7mL!
 *+?    \ !]  
 
. ) ƒ#6”6uI
v
«a³ ©¤.² ³ ©
·H¬¸ Æ ©ä¹« ©Æ ©¤5² ¸ ¦«å¼ ¯a ¯¼ æ¹
¸³
¤.¦³¦
²!©a¥©² ¶.¦« ·H¬¸ ¦«
«£¨ ¸ ¬. ²F³
Ä£¤#© ²F³¦¹
¤Kª1¸ ©¹?§
ã
£
¥¤#© ²?²!©¤ ¨ © ²R³
¤.¦´
¨ µª+© ²r¥©S³ ©¤>¶.¦¤ª(£« ·?©/Ö^ KN 
Z 1
)  "  *+! ( ‹
."? 
# 
`
, 5"ÉH
 g
?  N ! ",lS ? ]! 5
Z G  r].  g! . ) 
# gGÑ^_ Ò 
`
.
> 9šÑ(œç”Ò h]  è(.
" I 8‡ G] 5  Q d 5Q?>  QPb!?]
 /02
2
7
",!  ! Ê:
 F …
."? 
# F, 5
"ÉH
 FN ! ## /=. "B  
  . a"?! .
 F 
  
  ? + 4! # ) ! ;~) 5*1*+? œ  ( #) Z
Z.
&
 /# 
  ",  
. . Z
 ",! #/  
".
 $\ 
+","!$     \ =) 
  \( 5
  ?ƒ.6×EØI
`
 # !=# #?  ?
.
! 4 H ",*1  
 4 ]  "(  (*+  $

 
Z  + . .  ]   @ 
Í
$ <#? ?€


)  "   \ 
 ]! 5 s
¦«²,¬¤)¹ ·H¬¸ ¦«(¥© ¨ à £³
³
¨ ¸ ·,£ ¬¸ ¦«1³£¤£
²?²!©ª1´
¨ £
»©1¥©1·,¦ª1³¦
²?£«!¬5²Ö"? h .4

.
"$   )*+
• é
4 .
"B ..
 *+!   \*(   \4",


Z+ “›#-4   ZI
¬ ¸ ¨ ¸ ²£ ¬¸ ¦«¥Ã ·,¦ª4ª(©«¦ ¬5£ ¬¸ ¦«³ ¦¹
¤‚¨ £F³
¤.¦
¥¹ ·H¬¸ ¦«;¥© ²1£¤5¬.©!¶.£·H¬5²;Ö N €! 5  
   . 
• Ù ÙÊê1ß
  5  1 *+ 1"!#  (
.=)  +

??"   (*+ #) @   \;  >=.*( "?
`
?€( =>=# #! >\ 
Z.*4*( \N 8ÊÑ I

20
Source : http://www.MySQL.com
21
Une liste complète de ces entreprises est disponible à l’adresse : http://www.MySQL.com/customers/#Retail
22
Source: http://dev.MySQL.com/tech-resources/quickpolls/
23
Source: http://dev.MySQL.com/doc/MySQL/fr/todo-MySQL-5-1.html

©Kamal AOUDA 2005 www.kamalaouda.com Page 11 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

ª1³
¨ ¸ æ¹ ©¤:¥
£«²Ú¨ £V»© ²,¬¸ ¦«ì¥© ²š³ ©¤>¶.¦¤ª(£« ·?© ²Ú¨ © ²Vª(£«£
»©¤.² äF¨ © ²Q£« £¨ Ų,¬.© ²
ä¨ © ²
• ë
£¤#·Ä
¸ ¬.©
·H¬.© ²äa¨ © ²Ú³
¤.¦
»¤.£ª1ª+©¹ ¤.²äF¨ © ²C¬.©²,¬.©¹
¤.²ä/¨ © ²Ð£
¥ª1¸ «
¸ ²,¬¤.£ ¬.©¹
¤.²C¥© ²ì´£
²!© ²Q¥©
¥
¦«
« Â
© ²‹© ¬—¨ © ²r£
¥ª1¸ «
¸ ²,¬¤.£ ¬.©¹ ¤.²T¥© ²T²!©¤>Æ ©¹
¤.²:Ûi©´,í#£³
³
¨ ¸ ·,£ ¬¸ ¦« sÊ 5!r  ] ! +d ##
 *1
  @  gS*+d*+l Z# G
1N 
? 
# @  P  ¡  ? RS >=.*( "?l?!
",?] 
 *+! 4
) r‹"$.ZR9R . ] . 5! 4 D"B_ " RR ]  
 *+! ”IJ‡ h .
 *1
  ",    a*+< :9r·,¦«² ¸ ¥Â¤#©¤i¨ £‹³ ©¤>¶.¦¤)ª(£« ·?©·,¦ª1ª+©q¹
«q´ © ²?¦¸ «…¥à £ ¶>¶.£¸ ¤#©²c© ¬
«¦«1¹
«1¤# »¨ £
»©(¬.©
·Ä
«
¸ æ¹ ©4¥©4¥©¤)«
¸ µ¤#©;ª1¸ «
¹!¬.©¼

1.3 Périmètre de l’essai


J *1*+:?a  #T N   @  &"? p ,?œ c . . @  : c
.
 <*+ aT>=.)*( "? @ 

K
?! p[9q [*-   [
: N  _!&K    Z: i q",


Z [

  ",  [
",*1*+#"?4  
"H .
 @  4  (
! ^4


 \?€ @     -   \??  

?!
 
I

f! € "   ^1 ) *+< .41 # !!  ???  ^!*(   \ h ) 

  4s

Ì 1# !  @ 


H",
 
"B .  N 

  ",  (9 N j“! .)  ”I

Ì (!>]  
’i( (!h] 
N 

  ",  I

Ì  +] .  -  4b!] †  5 !Ñ-
"$
   !    !
I

Ì 5! *( . ) ?!    !  N 

  ",  1 ", *+! (91 , 5"?I

Ì ?€(!") ? 5-€ "! . ^(",Á . 4("  ! ~ † !") ? ”&Hb! ]
!") ! >ƒŽI

â  5   
. @  r N  ?? T",?]
# @  ‹  
$
! …N  _!&‚
q   Z A
‚
`
",


ZI  g
$
! T‹ . , )&pR 
  *+! ( -l*( ! ."?R! (  . R!" *4*+!
€ "   #"? @  N  €
 , 5F ͟.9c
a*1
#a",!! @  ! …  ]
#  N 5  "   @ 
 . .?
1*(
Z*+!  ( h=5)*( "? ^
\"? \Î 
$!
! 
I

1.4 Méthodologie adoptée


â V",*1*+ "?.îT =) 
 g W >=.)*("?U
î ï",! .€! .Uî",*1*+."?
‚
 
"H .
 @  1   @    4*+ ) @   (   4  "$ *()ÉB @ 
! )*+ h .!  N ]  ? 

 ¡;  R!    ? .
.r 1  R*(
Z. @  S; N @ 
  DD ]   *+! )I\â‚
€

  @  .GF C 
 .C",*4*+?  C",*15 5*+! N 
l]
   .   
P  .Ð !
 ?=)   "? Ð >=.)*("?GQ N 

  ",  P   l"$ €PG*(  <#G
G   ZP ;

",


ZI

©Kamal AOUDA 2005 www.kamalaouda.com Page 12 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Ì g  
 ]  T¡ ¡
$
!gN  _!Dr
."? .9¡ N  !  =) ",  T r  ? q
 >=.)*( "?F9:5  ‚ /",
N ?    ?   @ 
#! #? f h_

 @  *+? ‚
 …",, #) "B  
N 
 

  ",   ",*1*+#"?/  
"H .
 @  Iâ‚;=>=#
"B  .; 
 .
/
. =)  
Z
"? [  ? F .! K"H*1! .…  
" =) " . c*(
< …N  =h=. # a~”O0O‚&‚O0J&fJK0JKƒ'I
`
Ì X .)*+ŒÔ"? h .—
$
!—Ç
# !! ..Ç N  ?!!  : 
L Ó
. =) r8ÊÑ =.
"$  
 
   h_ >=.*( "?FFðf *+F !€

  @  .",*4*+? K  ! ‚d #…?    !
v

*+   #  @   . P  ;",*4*1

 ",  (\! (  N @ 
  44 ]  
 *+! )I
Ì q  
 ]  cr ‹
$
!:   Zq:
?!.…q#]
 T
   
.[!  çñ h .)[
 > .):R h=.*( ", @ 
fN 

  @  ! i? K
 q?€T",*1
?! 5cR N 

  ",  
@  N 9 N #"$
 .
"H 
.49   @       \?!  ! . Z# 
I
Ì /  
 ]   F a
$
!
/",


ZF1 _!5  
.
 <*+ 4F >=.*( "?  
9— N !    ?  X ± Ÿ# 5 @ 
q#! ##! P$
   *+! ¡
È Ô",H ) "B  XN 
 


  ",  GQ",*1*+."?Q  
"H .
 @  I â‚G
.
!.Sl=)
/ 9ì*+  
#C 
`
? !  4
•  4# ?#14;  *1 .•  (", ! @   "? 
I  (  *+! >(",?] 5 5-

"? > .;
$
!+?! s

b!0Ke‚&?b!0ee‚s
`
 -"$,'  \4",.
"H .<. ~#" 
?!4œ #) Z
ƒŽI
• `
 -",  
"H  (~ † 
"H 5.
& ò‚
 $! 5
  ÝFƒ'I
• `
 + "  
I
• `
1",
,  Z1  -’\.

 ZI
• `
1Z ,  (
 -)# .(~)  "\", ."$&, >_!ƒŽI
• `
 i=) "$
 .4I b Ì pI
• `
 \

  5 I
• `
 ->]
  >-   ib! ]1>]  
Z 
I
• ` v
 4ef! .)
) !(b! ]O• 
I
• `
  Ì j? +
! \+


 -   -",
  "H . .(~5b
kÊOœJ&!",
 
"B 5b݃ŽI
• v
`
Ñ^_ Ò s
`
1"$ €( (*( .
5\+, 5"!ÉB
Z1  i “_
  \
4


 
I
• `
 ^ .
"$

 @   ^N  € # I
• `
 +
."?  # ^, 5"!ÉH
  I
• `
N !  *1 ?  ( (# @  d 5 
I

©Kamal AOUDA 2005 www.kamalaouda.com Page 13 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

1.5 Résultats escomptés


J ,   ‚
# !=# #?  

‚#*+  œ?€
.
 <*+ 1  ?!*+? •
 .*1!; 
K
",Ï! 5îZ# ïD X#5 r V .]?€UN !  *1 ?  U9È ï=) ïï"B_ " Y
`
 ]  
 *+! )I  ^
!5 5^1"?;# !=# #!  B!(   ! 9 
   
.(
 ]  ?€ s

.
!^
 : *(#"$ ", "#< .r ^ ! . Z#i r*(
Z*+? p c h=.*( "? 
• v
 ?€1
#*1 <# (
$
! ^+"B_ " 4+ ]  
 *+! ”I
k =) 
 œ  1*+ #) @   +   1  "$
*()ÉB @ 
 *( > .? N ]  œ / h=.*( "?; 




  ",  ;",*1*+."?  
"H 5
 @  IJ‡ > .
=) 
  ;]  9a N  _!/ 
  ", .
.( #.
  
  4",*1*+/   
  œ ; .*4+/# !Ief   , ",! #
   
  V",
ÚN !    ?  &c W*(
< Uï",*15 .*+! q î!    ? .
.Ú ‹ î]    
", "
)#?    I
.
!
 c *(#"$ 
Ê _!p ‡ 
" =)   …  ? a: >=.*( "?c
• v
* d*+(  # @     +  ? \N  =>=. # 
I
+
 
"?!1 4" 
?  =)    D
)  " ?€l h .)‹ +!  çñ > .)‹P >=5)*( "?l!


]   


  ",
   . 4?€S

  ",  ^1",*4*+#"?4  
"H #.
 @  I
Ñ  h #…a€ .Z :  )#
5=)# @  *4*+! K",*1*1 ! /
a 
.
Z.*1*(  F 
(



  ",   F",*1*(."?F  
"H .
 @  F ‚
. !  ? !  / K   ]
 .
*+

 ! 
 *1
"H 
  + >=.*( "? 
I
`
{ #: : !  
p  a?]    =. "H  
  . /: a] .  a7I 2[Ñ^_ fÒ  Ê
 !

5  "
  <#*+? "?    @ 
H",! ) 
 ? 9  N *+   .  ( + >=5*( "?  I

©Kamal AOUDA 2005 www.kamalaouda.com Page 14 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

2. La performance dans le contexte du commerce électronique


k 1 /  > . . 
#  ( = 
  ( / >=.*( ",;! *( (?? "?! #
 4
œ 
‚

 
5   Î4"!) .<# =.!
*+! 5?€&!94? ] s
©;¬.©ª1³²;Ö ! ;"?") .<# , ",   # ~# ƒ",*4*+/ h=.*(! #~# ƒ'& 5? ~# ƒ .?
 &
ß
.Z

 ?  (-H_H .<*+ @ 
?#   !4! ^ Ÿ#
"H  =.i
+  \   + *15   I
©T·,¦ó!¬fւ! "?T"!) .<.‹ g >=.*( "?q!‹*(  
#‹\.
5 A9g T"," . q
ß
#   ?  ( \ Ÿ#
"B  =.i1*( #4",Ï? ”I
©Y¤#©«¥©ª+©«!¬œÖ! V"?U") .<#Y ± h=.*( "?î!Y*+  
#Y‹.
5 9± 
ß
*( €
 *1 ?  P S!€! #.! 5G~.? 
! >?ƒF
??
" l9Q"$ @  Ð# ?? #"?Ð?]   *+!
",?*4*+
;~ @  N  BN 
Z ?!4( .*1!- “›#-N .Z! 5ƒ'I
Of  @  1"  # -"? \ =) 
  +# , .?  #.(Z  5  +
  +  ? \1
# !!  ,? I
ef   (
 ] ! d #;=>=) 
 (
 ]! 5
Z •*1 ?€;#=) .a  - 
" =) " . \ 5
"$
 
Z @   
 œ=. "H  
     

  ",  a",*1*+#"?a  
"H .
 @  F   @  c 
  ?  
"H .
. @ 
!5  "  ! 9 
 ]  
 *+! ”I J‡ -*+< 19;
"   œ  - =) 
  
 

. ( .? ",*1? .4 4  ? - 4!    ? .
.(  +*(
Z.-N   5  "?,€
  N @ 
  44 ]  
 *+! N ! #;> )I

2.1 La performance telle que perçue par les utilisateurs et les managers24

2.1.1 Le temps de réponse


k ± ! rU]
 YÈ N !    ? .
×& ï .*1ô
X# !± , R È*+ #) @  X È
  
‡
#
# !? 5  ] F a >=5)*( "?N 
 

  ",  1õ?6”ouIef=>=# #"? @   @   @   
"  ",4! #! f   .N  ! #
) !"? 
! 1", "
)#? 5
&  ,  #<   *15 5? @  
`
  ï# @  d . ô? ! T 5 .
 ô
ï  ï
 ±
#=.ô   
I  V .*1!ôX# !
"?"?! 5
  ì  N !    ? .
[ !" .? :
   
5Ð",! #. ] 5! Ð"$  öì  Ð€
 > 5Ð
!  *1 ?  [*(  ]! N [) ×&œ  , ‡
) *(. N  _!Ê N ] !    ]
 . ?! 
U",
 €
 V9± N j“? .  ? 
 Vî
 ] V V*+ 
Z  @  N U
 ]  V 
! # ) ! 
I

24
Les managers dont il est question sont supposés relever des fonctions métiers et non de la fonction chargée des
technologies de l’information.
25
Cette affirmation est démontrée par plusieurs études spécialisées dont les plus connues sont:
Zona Research, Need for speed 2, http://www.keynote.com/downloads/Zona_Need_For_Speed.pdf
Jakob Nielson, The Need for speed à l’adresse: http://www.useit.com/alertbox/9703a.html

©Kamal AOUDA 2005 www.kamalaouda.com Page 15 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

k …",Á . c [*+ 


Z  &‚  a",
 €
 F97
÷Tøf F?!  5 Ÿ.
.[*(BŸ.) > # …*( Z# q 
‡
",*1   /"$)
F9c  @    F!c  ]
#! ¡  a{ Ì j•
‚ *(".  !‡   "?"?< 9c$!
 
  Ì *+ ) @  1;.I8‡ ; *+
œâ‡  !,›>›×â )‚  Z
((02
2 ", "  &
­
9;"?  Z
.& @  173 I Î
ùmL +*+ 
Z \*+ ) ", \!1",
 
"H .!  5 Ÿ.
.^9 N j“! .) 
]
 

;*(
*P9 7
÷øf
-;*( (",! # xI ÷3!mì
•  (",
 €
 -9$! .+]
 . ?!~>] 
­
=) Z
#/0
ƒŽIhk‡",Á . /  ? # ) ! 
&   ",
 €
 ;9[$! œ 
 ‚#
# !! 5 ! f‘
ùI xmV
02
2 ",! ##402I 0mÐ
  -",
 €
 \917
÷øf
!\4*( (~>] 
=) Z
#4Î ƒ'I
­
26
Figure 2: Vitesse de connexion à l’Internet des ménages aux États-unis

Figure 3: Vitesse de connexion à l’Internet des entreprises aux Etats-Unis27

k  r€
 5 5rD!    ?
   . D",*1*+gb!ÉB¡â‡  !?6”„#
",*4*(! 4
‹=>=) "$
ZR 

#  
 5 >cr! Úr÷q9S3,2T!
", c 
 ]? ^ N ?]œg R# @  d .‹*( :"? c!
  

 ] ! •d #/.*+ 4;",! .€! . N !    ?  ."?  . " . N 
 ! .)!! .;=."?9F 
  . "?;N 
4  .; ",*1*+#"?  
"H #.
 @  š ;  /
(!
 *+! 1?1]
 . ?!;
",
 €
 1*( \ Z
 *+! s

26
Source: Nielsen//NetRatings, Web connection speed trends—U.S., http://www.websiteoptimization.com/bw/0406/
27
Idem
28
Pour plus de détails consulter l’article: The Need for Speed à l’adresse: http://www.useit.com/alertbox/9703a.html

©Kamal AOUDA 2005 www.kamalaouda.com Page 16 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

©R¨ £R¤.£¤#© ¬.ÂT© ¬>í#¦¹q¥©¡¨ £‹·Ä ©¤5¬.ÂT¥¹r´


¸ ©«!í#²!©¤>Æ
¸ ·?©Tæ¹ ©R¨ à ¹!¬¸ ¨ ¸ ²?£ ¬.©¹
¤²?¦¹
Ä£¸ ¬.©q£·Ä © ¬.©¤fÖ
ú
  B ?  
 ,›#!>]
 "?4 H   
 
 49 . =)  ¡94 (
) €( @ 
 ] ! 5^4*( # 
&
 N !    ? .
[ N "$ < ..Ð
[ Q  .QN 
 Ð? # ) !Ð", "
#! .I F"H! #C + 
v

 ,›#!>]
 "?a H =>=#5 ‡ /  .  @ ?  5   *1 .
  =. œ .*1. #*+?
 N  Ÿ# -N 
 l
.*(  & N !    ? .
(!.¡"?5 5  *+! 4
  ."?‹]
 ,ç)9
ç#]
 Tl 
  . "?‹~.9g*( …N ?]
 ?
Z\
 q .)  ] ‹
 @  T ^*(5  5ƒŽI Ì  ##N € *1
 &

 ¡ l*+
S;ø•_
 .l*(! ## @  S R . " . R R?    ? .
5q=."?R9P 
  . "?r , \
 cZ.‹
-  c  . cN  ! .)*(    c=)  " <#g#", @  g 
.
.?"B  ;?! • ##< ;!  
  ; .*1~#"$Z*+! ‚.
 /  ",
. &)  @  /
 

  (   . \ ? + #.?"H  ( , #5 .
ÝFƒŽI
29
Tableau 2: La ténacité des utilisateurs serait plus grande sur les sites d’intermédiation financière

¹ ·,£
²+¥à ¹!¬¸ ¨ ¸ ²?£ ¬¸ ¦«Ö€ *1
  N  =>=) "$
Z1 
Z;N "?"  ,*(
*( (
ú
. " . @   
??  1N 
 ",*4*(   /#< Z *+? N 
1"$ ”Ij 
*Ð f 
#*1
  ??
Z4N 
4
 N "$   N  !") !  (9 
    > ##4;?]    Ý
¹qª(¦
¥µ¨ ©¥à £ ¶>¶.£¸ ¤#© ²;ÖK  q T*+
r\ø•!_
 .E”4*(! ##9q"?  Ÿ# @  r  
ú
!    ? .
.q
‹
g*( < lO0OG?! +*(  ."?r]
 ?ç)9
ç#]
 q¡  . ", @  ¡  
!    ? .
.N 
c*(
< O0JC~#"? q N  , p
?![   ] 
"a q
# 
*1  "?… 
",
 €
 \9$? .-]
 . ,!1"$  ö+  -! ##
) !  &!J‚=×IH=) Z
#GÎ ƒŽI
¹F·,¦ó!¬¥©c¨ £…·,¦«
« ©§
¸ ¦«Ö"?F! @  N 
[?    ? .
 @ 
 _ c
=.>=. ‡
‡
 
ú
",
 €
 C    *1 .
Ð
). *(
 =# , .F
 lP . " . S=."?L9M M  5 "? @  N 

!    ? .
 @ 
H , =."B 
# +\=. "B  (\ .*1\+",
 €
 I
† q ‹*1
  
  "  .  F=."H .
. @ 
f ?=)  ! p 
^  . " . c=."?9‹ ‹  . "?&K • , Ê #< 
 =>=) "  /=) € 
!
 5*1;a# !a œ >  
. =)  ;N  ! .)? .    5  
",
TN !    ?  I\j   *+! 4  r! ##
) ! T!]
. ! 4*+  
#( 
1  q  . Tl 
.
", "
)#? 5( + .*1^;# !4
,?" 491"$ @ 1",
\N ?    ?  I

29
Source: Zona Research, Need for speed 2, http://www.keynote.com/downloads/Zona_Need_For_Speed.pdf
30
Source: Keynote Systems Inc, E-COMMERCE RESPONSE TIME: A REFERENCE MODEL,
http://www.avoka.com/resources/keynote/E-Commerce_Response_Time_CMG_2000__Chris_.pdf

©Kamal AOUDA 2005 www.kamalaouda.com Page 17 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 [#  
 5 5  ! . [
). ? K!>]
 ‡:  "$
*(ÉB >=.)*- "?…9… #. ] .
5! ‡ ["B_ " aa ]   *+! )Ifk ?" .  
"   !
 /=>=#
"H  ! ‡# Z
  <#*+! ",
h_
 [*+  
# HE'% 
    .  9/=.5 . =h=)   "?F 


  !  
./#  
 5 > ?1=.)*+
î  "$
*()ÉB I )*11"? Ð?" . M"!N  , qø•_
 .î~”â‚
?
 @ôû øeÞAâ‚ü:ðf$ ïj“! .) 
v
>=.*( "? Ì ? $) “_ƒ#E)6 @ 
'Ÿ.
 4  
 \Z.  5) . ; 5*4*+! +. ?(  
v `
) Z 
q?T *(#"$ q A‹ =) 
   . qq! #  
 5 5 I ‹# , 5qT"? > .q!
"B  

?!SS#]
 P  ¡  "$
*()ÉÍ @ 
#!=) < .! ; G*1 ?€S  g 
" =) " . ‹ g  . g
",*1*+#"?¡  
"H #.
 @  I\j“‡ , 1 *15 5? (S 5 @  ¡"? R  "$
*()ÉBg D?! 1

", Ü;
œ*+  
#f / >=.)*( "? N 
 1 .
"$
! 
Z  


/~5b!0ee‚& 
 )⠝1? # ƒ
*( V

 @  *+? T V .*1ìU# !ô
??
" ô?€V",
ìN !    ?   @ 
/#! .!
$
    *+! R
W Ç",*1
   ±N 
 X

  ",  ±È",*1*+."?X  
"H .
 @  
~)#
"$ #"$ 
(5  " 4
+
+", 5 
Z &??]
)  +",*1? .&?N ! $ ?  =) fÝFƒŽI

2.1.1.1 Benchmark pour les transactions E-commerce (Keynote E-Commerce Index)


J /  "$
*()É(*+   #&  
 +  . (1] ! . 1 5  &  ( .*1+/# ! 
??" 
‡
?€+",
^N !    ?  ( 
 ]!! 54s
‚N ! $ !  =) A:#! Z! 
 ?  =) ! p 
:*( ÊT ?!q~#"?   

! @  
 N !    ? .

?!< 4 ͟.9 
+",*1! .+   +  .1 @   ,  ƒ'I

"$ #"$ 
1 .

 “›.?>]
 "?4
(
+", 5 
Z I
Ì Ÿ.! ."?;
.

 ›#!>]
 ",41
 N "$ )I
 Z  4  .

 ›#!>]
 "?I
` `
   . ?! K!  
"H  
 F=. "H  a N  *15 5 "?… 
A5 K*(#"$ I 
.
!>] 
.+?! •","?! ## 4
4 €;Z. ;*+ #5  4*+ ) ",   HE”EK ?! •",
 
"B . 
`
9 N j“! .)  Êp N  ! .*+   #[ a
 /Z.
[{ Ì j?€cý 5 5?çñ

  I  F*+  
# /?!

) ! ! 5*(  @  *+? ʇ 
Z! 5[~#
") 5FFb! ]
ƒ @ 
  *1
 ! K / .?"B  
=.! 5Á*+ HEž;^ r
  [q ]
 Z
 .
\Ñ1jheD?FõT 
’[02
2
2I‡ef   [?! A=>=# "H 
 
@    
 *+! ? # x$; •*1 

 ]
  4",
€
 +9$! .4]
 . ?!~>]!) ! ;ðK3\9
`
ð•Î ƒŽI ô*+   š M*+  
# C  4! .
  Ð , :


 
ì 5M  ì*+#"!#  Ð
€ "   ]
 . 4 
 4  .+N eç”",*4*+."?+ðf *+ \9  N 
# ?!s $! h s ›h›
",*4*+#"? # *+ 
I ",*

31
Pour plus de détails sur la méthodologie de mesure se rendre à l’adresse:
http://www.keynote.com/keynote_method/keynote_method_main_tpl.html
32
http://www.keynote.com/about_us/about_us_tpl.html
33
Boston, Chicago, Dallas, Detroit, Houston, Los Angeles, New York, Philadelphia, San Francisco et Washington, D.C
34
Traduction littérale de ghost transactions. Il s’agit d’un ensemble de transactions fictives qui affectent des sites réels et
qui simulent le comportement d’achat sur Internet.

©Kamal AOUDA 2005 www.kamalaouda.com Page 18 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Tableau 3: Résultats du Keynote E-Commerce Web Transaction Performance Index, semaine du 24


35
Janvier 2005

RESPONSE TIME "SUCCESS RATE"


Rank Site Time (seconds) Last Week Rank Site Success Rate (percent) Last Week
Index 15.18 15.47 Index 99.45 99.23
1 Office Depot 10.14 1 1 Eddie Bauer 100.00 1
2 Eddie Bauer 10.66 2 2 JC Penny 99.81 2
3 Wal-Mart 11.64 3 2 Wal-Mart 99.69 4
4 JC Penny 13.33 4 4 Office Max 99.62 6
5 Amazon 13.49 5 5 Office Depot 99.53 7
6 Best Buy 17.38 6 6 Best Buy 99.52 2
7 Sears 19.68 7 7 Sears 99.36 5
8 Costco 23.13 8 8 Amazon 99.33 9
9 Office Max 25.00 9 9 Costco 98.21 8

2.1.1.2 Benchmark pour les transactions bancaires (Keynote E-Banking Web Transaction
Performance Index)
J‡   "$
*()É^*+   #   ^ .*1^;# !4 ,?" \?€(",
\N !    ?  ( 
 ]! 54s
‚N ! $ !  =)  
 4  .(N 
   @  14#! Z! 
4 !  =) !  
4*( 


?!I
Ì =>=) "$   # ] +1"H*4! .1 ^] ) =)  +? I

Ò(
 > . +  .I

`
 *+ $

 
Z g¡*+  
#¡!    !
R , + !  @  g9D"?  gþø•_
 .leç×JK*1*+#"?
l
`
j“€I :*+   a F.  
 5 5! .
/ H ‡


 
c$ 
*(

 #*+!  
Ê a  .a
k‡ Z 5Íðf.?"H  HE)tuI
37
Tableau 4: Résultats du Keynote E-Banking Web Transaction Performance Index

35
Source: Keynote E-Commerce Transaction Performance Index, http://ecommercetimes.com/ectpi/#infofaq
36
http://www.digitaltransactions.net/index.cfm?pageid=22
37
Source: http://www.digitaltransactions.net/index.cfm?pageid=22.

©Kamal AOUDA 2005 www.kamalaouda.com Page 19 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

2.1.1.3 Benchmark pour les connexions à 56 Kbps (Keynote Consumer 40 Internet


Performance Index)
`
 5  "
 ) . /"?F  "$
*()É( , @  N  
*+  
.F  .*14F# !!F
"? ?? #F

a
 N  =>=) "$
Z…N 
 
Z…N "?"  A q
  ÇN  c",
 €
 a9:7
÷Tøf
,E)„(~# 5
  a]
 
`
 1*(
*( † ù
2   .!  5! •œ  1{ Ì j 
 ]! >1s Ì ð•ÿœð‚& Kè4&e> $
  
É&Ñ(Kâq Ì è ƒŽI
`
 *+  
# ?! K ) !  5! .   $ 
#  &‘4Ÿ.
. 
‘a! ##a7F*š ‚ù[
* Iœef    
 
 ! 
\",*4! .4\ 5*1(# @ 
 +
 5
   ;",
 €
 ( ] 
"(   !   # ! "?
~ è ƒ;{ Ì j>I
v v
39
Tableau 5: Benchmark pour la connexion aux pages d’accueil via des connexions à 56 Kbps

2.1.1.4 Benchmarks sectoriels


ð Ÿ.
.\! 1 *+d*+ *+ $

 
Z u&
ø•_
 .1", Ü,  +  "$
*()ÉB+!
*+  
#

  r .*1rP# !!D 
" =) @   ‹9l ‹! "H .
.‹Ël l",*1*+#"?l  
"H .
 @  l H
*1
 
# !? ”I
j“BN 
Z  >*1*+? s
k œ©Å
«¦ ¬.© p¸ ¤)¨ ¸ « ©
©´ f¤.£«²?£·H¬¸ ¦«¢•©¤>¶.¦¤ª(£« ·?© «¥©§Ö @ 
•*+   #q … .*1F

‡
ë
# !
"? ?? # ‡N ! $ ?  =) ‡ ] ) =) p …? c", .!  
p
c",> .…
 ! 5+~
=) _ .(*1   ?ƒ 41 I
k‡  œ©Å
«¦ ¬. © ‚¦ ¬.©¨
© ´ f¤.£«²?£·H¬¸ ¦«R¢•©¤>¶.¦¤)ª(£«·?© «¥©§s @ 
K*+  
#D r .*1

ë
# ! 
"? ?? #  # !>] 
 4"$*1 #4N $Á . I
k‡ œ©Å
«¦ ¬. © f¤.£ Æ © ¨ K»©« ·BÅ
© ´ f¤.£«²?£·H¬¸ ¦«P¢•©¤>¶.¦¤ª(£« ·?© «¥©§s @ 
*+  
#G 
ë
.*1Ú±# !W "? ?? #W R# "$ #"$R
 ï=>=#W
"ÉB
Z
±~#"$*1
#
N $Á . 
    N  ]
 ƒ 
 4  .+N 
 4
Z "?+-] _
ZI

38
Pour les autres benchmarks la connexion se fait via des lignes T1 à T3.
39
Source : http://www.keynote.com/solutions/performance_indices/consumer_index/consumer_40.html
40
Pour plus de détails sur la dite méthodologie Voir 2.1.1.1 Keynote E-Commerce Web Transaction Performance Index
41
Kilométrages gratuits offerts aux clients au fur et à mesure de leurs achats.

©Kamal AOUDA 2005 www.kamalaouda.com Page 20 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

42
Tableau 6: Les benchmarks sectoriels de Keynote, semaine du 24 Janvier 2005

2.1.2 Le débit
{ 
*+! 5 *+! a"? h 5Ú*+ ) @  Ú ! . # ?!Ú  ",
ì
 Ð  Ð*( 
Z. @  Ú  
!    ? .
.
I1ef  Ð*+  
.L
G
C lP .*1l

 ?žñE: Q"$.ZGG . ]  @  
 N 

  ",  ’ia , K",
 [a . .×I• p
  .qj“? .)  G
   
.a  ", .
./??
`
.
  
   *+! !    ! +
*+  
# ;"$.Z+( . ]  I  +
 \",*4*1
^?! )s

42
Source: http://www.keynote.com/solutions/performance_indices/travel_hospitality/results-122704.html
43
Une seconde en général

©Kamal AOUDA 2005 www.kamalaouda.com Page 21 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 *1 #4;# @  d . i(;# ! ($! h I
`
 @ !  . + 
 5i .B=. #
1? #; 1"  !   (!>] 
”I
`
 *1 #4N "?"?< \", "!
)#?   +~)?    ? .
.\","? 
!   *1
 5 *+! (  . ƒ'I
`
R*1
#rR
Z ", 
 .
 
Ij“ , - *1> 5! iR . @  ‹"?R*1
#R N  , -

5 Ÿ.
.l Z
A9C"? 

 P# @  d . P$? > I1efS!=>=# /#"? @  N 
 Q
Z
lõS",!  !

   
.",*1
?? 5͞”ž\ =)
# . ‚
 Z  #‚[*1
  
  # @  d .  ]? …?] 
 N  =>=) "$ \ 5 5  . I
`
¡*1 #gr .?"H  
Iik‚r g
*(  ‹qõR D*( i .?"B # R N l
‹ 
*+d*+‹","?!   @  ‹ r ‹
*(  ‹ r
! ‹


 
Iij“   Z D g",

 
=.*+ 
 ;# @  d . $? h +   # !-_(=>=# #? .?ž×ouI
ð_

 @  *+! )& N ] !  rr 
 \N 
 g

  ",  rR",*1*+."?R  
"H 5
 @  g 
 -Î

$
! -",*1*+; ;*(! #.  +=) Z
# I
­
« ©T³
Ä£
²!©c¥©·¤.¦¸ ²?²?£« ·?©sœ
.?   @    T :

 ÊZ*+? .T    #*(! ÊF=) A Ê9
Ù
*+  
#+  N Z*+? 5  (  ;"$.Z+( . ] ,~J‚=×I   Z$!  

+ö!  ƒ'I
« ©³
Ä£
²!©³
¨ £ ¬.© £¹ s
5!   @     ; 
  N 

  ",  +*+
#1, 5
  @   @  1?
Ù
 ;"$.Z4( #. ] Í #. .  ~J‚=”I $  ]?_1 

+ö!  ƒ'I
« ©a³
Ä£
²!©¥©/¥Â
·¨ ¸ «֝
!   @    a  
 œ! Z.
F . @  F " $.Z . ] 
Ù
"., ~J‚=”I 
 "É? (ö!  ƒ'I
46
Figure 4: Courbe de débit d’un site de commerce électronique

`
 #   ! #a  .*1!;a# !& F"$.Z/ . ]   ‚ / 
 ‚  
! f"$"
 
[
1"? +
$ ! - , €

  @ 
1" ç)
#< 4s

44
Images, sons, vidéos, autres pages incluses dans des frames…
45
Source de la definition: Stacy Joines, Ruth Willenborg, Ken Hygh, Performance Analysis for Java™ Web Sites, Addison
Wesley, September 10, 2002, ISBN: 0-201-84454-0, pages 464
46
Source: Gennaro (Jerry) Cuomo, Srini Rangaswamy, IBM WebSphere Application Server 4.0 Performance Tuning
Methodology

©Kamal AOUDA 2005 www.kamalaouda.com Page 22 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

¢•©«¥
£«!¬¨ £a³
Ä£
²!©¥©/·¤.¦¸ ²?²?£« ·?©Ö  .*1!1# !F*( _ # H .#   ] *+! , 5
 
 . @    ;"$.Z4( #. ]! BZ*+! .I
•¢ ©«¥
£«!¬•¨ £/³
Ä£
²!©³
¨ £ ¬.© £¹Ö ; 
  , ",, 5? *( 1 1 .*1(# ?;Z*+? .;

=.Ü,1    #  5 @    1"$.Z4( #. ] BZ*+! .I
¢•©«¥
£«!¬¨ £³
Ä£
²!©4¥©4¥Â·¨ ¸ «Ö  + .*1\;# !4"., ;*(
 <#1€
 !      . @  
 ;"$.Z4( #. ] BZ*+! .;~) (=) Z
#47    , #; N !*1
 44"? (#   ?ƒŽI
`
T",*1. ?:? #r c=. "B  
 *+? p a  . [",*4*+."?q  
"H #5
 @  q A"? 

  *(
Z

    ) @    Y*(5  ± *+ ô *1 ?€ ",*1
##|   #   
*( $ *(  @   :! ##‹"? c 5 T*+  ) @   :r
 ] q T
$
! c‹"!. ?? "?‹ 

  . I
47
Figure 5: Relation entre le débit, le temps de réponse et la charge de travail




? @  V
š
 ô 
 "?) V
 .
VV7ô", ?! Ú U#< Z *+! cN 
š5  " 
*(?ž×„‡s

3 *1 
! . 
 F*1
#
/"  ! 5; ,  ?=# )  œ Z
/*1
#/", ?? ; !>]
 "?I
;
`
k‚+"? ",
1  N _4/
+4=)  ;N  > .! .I 4 .*1!(# ! ",*1 #

 @  *+! • 
.*1r
"? ?? #D
( D#< Z *+! ž×ˆ;D N "$ - ( ‹ 
 ^D N 
 "?)  o׏1Z*+! .
Z.
   *+! œ1=. "B   /*1
#/"  ! 5 @ 
!F
# !! .! •9a ", ?!F~./297
"  ! 5ì*1 
! . ƒ'I/J‡ > .š    Ú#=) < .ô ô*+d*+š _
*1 @   @  ô î
$
!š
". ?? "?4N 
-  .44"H*1*+#"?1  
"B .
 @  I

47
Source: Stacy Joines, Ruth Willenborg, Ken Hygh, Performance Analysis for Java™ Web Sites, Addison Wesley,
September 10, 2002, ISBN: 0-201-84454-0, pages 464
48
Ces données sont fictives et reposent sur un modèle très simplifié.
49
Lecture du code à barre, insertion de la carte bancaire dans le terminal de paiement, emballage…
50
Nombre d’articles achetés par minute

©Kamal AOUDA 2005 www.kamalaouda.com Page 23 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Figure 6: Equivalent de la phase de croissance dans un magasin brique et mortier

0*1 
! . (   /*1
#;
"  !  H  
 ) 
97  œ ,=# ) 
; Z
?9[3,2Ik‚+"?",

  47"  ! 5L 


 *+? > # +
 ] !  h .# @ /  4", ?  .( ! =) 
? !>]
 œ 
.
`

# 
"? ?! .
I r .*1!q¡# !g",*1 #g
 "r ‹ .*1qN  h .! 5RR
 q
.*1
"? ?? #F
‚ F#< Z *+! •F N 5  " Ij Z*+! . =.Ü,/    #9"$ @  
`
=.  @  1"  @ "  ! 5\

  
  \! 
# !! .!   *1
 5 *(! 9 ;", ?!I 4 
 

?r5 # H .",H 5! Êc÷ ô‹3, 2 ("  ! i~#c=>=# *+d*+: ] 
"a"? > ."$.Z:
. ] ? N 
 "?) 4!>
5 Ÿ5
.-74"  ! 5+*1 
! . ƒŽI
Figure 7 : Equivalent de la phase plateau dans un magasin brique et mortier

Ì  N  , 5A[ .*1aT. !&K


 ! ##
) !:!
 pT*+   #p 
   .! 
", "
)#? 5G C 
  ,?" C?€L", SN !    ?   @ 
(#? #? h_

 @  *+! 
L 
",, )"H  N 
 T

  ",  T",*4*+#"?T   "H .
 @  ‹~J‚=”I 5
  q‘ ƒŽIpef",#‹
 
=. r
 @  N    r# !! ^?€‹
# ","
  ! T*(
Z5q"? T*(  
# 
 ] ?
=. #, 5"H  / 5! 5F",! . ! ./ .
"$
 
Z @  [~.! #*+! f     
 ] ! *+  
#
 Ð 
 [#   =F?€Q",
GN !    ?  Q [Q"? 
- P .
"$
 
Z   @ 
-! !>]
-9
 *1
 *+! . 4  .44",*1*+#"?1  
"B .
 @   ƒ'I

51
Tableau 7: Exemple de benchmarks pour la mesure du débit (cas d’utilisation: accès à la page
52
d’accueil d’un site de commerce électronique)
Throughput (Bytes/Second)
Category Leaders At-Home At-Work
Portals - Yahoo 1,991 28,318
eShopping - WebVan 923 8,005
Brokerages - Ameritrade 1,306 8,402
Travel - Yahoo! Travel 1,407 20,481
Overall Worst Site 526 11,200

51
Source : Yahoo Wins Throughput Race, http://reviews-zdnet.com.com/AnchorDesk/4520-6033_16-4204488.html
52
Ces résultats sont basés sur le Keynote Consumer 40 Index. Pour plus d’informations sur la méthodologie du
benchmark voir section 2.1.1.3

©Kamal AOUDA 2005 www.kamalaouda.com Page 24 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

2.2 La performance telle que perçue par l’équipe de développement


`
 +
 *+  ) @   \ !=) 
  \ + 1!
"H  (0I.3- ;# !! 
\!  <#*+!
?€1  ? \
 N @ 
  cc ]  
 *+! @ 
 &œ9T : =h=# #"?… …!    ? .
.a ‡ a*(
Z. &D

 !  =)  @   ;  *+! 54F N 

  ",   •/# !  ?! •9a N ) Z   
.
 <*+ 1
 >=.)*( "?I 
•!
.d .•9F 
.   ? 
&"? ;*+ ) @   4
 ] ! •d ##? Z*+! .
 1
v

) "$
  -\ .! ",*4! .s
k - ",*1 ?! 5 @ 
?#? ##! 
+ 1",, #) "B  (  N 

  ",  I

k  -
  ",
\N ?    ?  + 1*(
< 44",*1> .*(! ; N !    ? .
×I

2.2.1 Segmentation du temps de réponse en fonction des composants de


l’application
#"? @  L 5? / H  Ÿ. 
lb! ]&; N 

."!$ M ì
 L .! .M a !  =) a  
v
 *(    @ 
BZ*+! .!  ( .*1!\;# !4"H  , .49s
3 I j !  =)  p"$ @  [=5 "H  
  . c[  .q  a" 
?! …!    !
 
&‚ 
.… ! .."H  
*1!     ‹ 1  +.
  "?*+! -
R R .*4R~)  r 
Z.*4*+ rR! @   "?
`
N 8ÊÑ ?! >  "
  <#*(! 

? . + !"$ *-  !"?4Z #4N  ! ..
"H # ?ƒŽI
0I Jp$
.*+  # 4 .*1!4
"? ?? #
• N  , 5 "   + - . (" 
?! (  N 
 H
 
.‹ ! .>=."? 
I~ © ²‹¸ «!¬.©¤>¶.£·?© ²q¥
¦«!¬+¸ ¨© ²,¬\æ¹ © ²,¬¸ ¦«D¸ ·¸‚²?¦«!¬+¨ © ²‹ª+ ¬Ä¦
¥© ²‹© ¬;¨ © ²
ß
³
¤.¦³
¤)¸  ¬. ²:¥© ²:·¨ £
²?²!© ²
¼p¢¦¹
¤^ÂÆ
¸ ¬.©¤i¬5¦¹!¬.©‹·,¦«?¶)¹² ¸ ¦«äA¨ © ²q· ¨ £
²?²!© ²…¥à ¸ «!¬.©¤>¶5£·?©T²!©¤.¦«?¬
¥
¦¤#«£ Æ£«!¬¥Â ² ¸ »« Â
© ²+³!£¤¥© ²(ª(£ )¹²!·¹
¨ © ²?ƒŽI
ÎI    #×&
f"? > .F
!&   *1
?! ;   1Z
   5 1N .Z *+? ~."!N  , •9/ #F  
" 
?! 1
!  N  , 5 "    /   ! .>=."?  . ]! @  ! 
/
 ",
Z€

!!  
.*1^;# !+*- *+!  Z ƒŽI
I Ì   _!( ‹",
‹ ",! 
 r
T  ? . " 
?? T
-# ] -  :*(    @ 

­
",*1
.*+ h .?   >=.*( "?I

2.2.1.1 Injection d’un compteur dans le code source (Custom Instrumentation)


`
 .
"$

 @  €

  @ 

 "? h ./! "H  ",!  , ./ N   Ÿ#
"H  N 
",*1! . f
 
/
",
4?
."?4 \" 
?! ^
! (?
$ .;*+  
.  >=.)*("?!o×EØI

53
Comme nous le verrons plus loin cette technique a plusieurs inconvénients.

©Kamal AOUDA 2005 www.kamalaouda.com Page 25 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

©‹·,¦ª1³!¬.©¹ ¤^©«qæ¹ © ²,¬¸ ¦«‹« ©r¥


¦¸ ¬-³£
²·,¦«²?¦ª4ª(©¤(³
¨ ¹²:¥©°È¥¹¬.©ª1³!²T¤#© æ¹
¸ ²T³¦¹
¤
ß
¨ à ©§ Â
·¹!¬¸ ¦«¥© ² ¦³ ¤.£ ¬¸ ¦«²£¹?§æ¹ ©¨ ¨ © ²¸ ¨ © ²,¬•£
²?²?¦·¸ ¼•k‚ ",
 ",? . .& a#
", .;9
"? > .ì .
"$

 @  Ú
 cd ##î#*1 Mš",!Ú  > 5! …
š  Ð

  ",  C=.> .*+?
 , ) 

 
I  z #. 5 )&— # ",*4*(
  N !    ?  ½ ",*1! . 
v
•_, .*;I " )#? >ðf *+Ñ4     ~.ƒñ#"? @  R?‹€
"?  ‹ 
1
 JÚ, 5
5 o)ž/",?*4*+
v
*( \42I 7;*1    !
",
.
J  c ”&• 
 a #.?"B  /’i=. )&œF) <#  &•
 ?€F!>]
 "? N 
 …!>]
  )&
‡
 geb
OL \‹b
kÊOœJšR ! \! Z*+? .4 ‹ .*1q¡# !r 5 5С l*(
 <#
 
 ]! .s
55
Figure 8: Exemple d’une segmentation en fonction des composants de l’application

Ñ   
#a G .*1L
"? ?? #M
"$ *1  F ì# @  d .Ð$! h GG"  ! ] .L 
(
1.
",! . 
  4!>]
  ”I
Ñ   
#; g .*1g# @ 
 R
; H 5 " ; ¡!h]
  ”I  4"? ¡¡ ? 4
 "?;

(
2. v
",*1! . •_!, .* I " )#! >ðf *+Ñ4     ~.ƒqš 
? …U U*+ $
î 
 ~#f>]
  #JK?=) Z
",?=) Z
ƒ.o”t @ 
a , ‹! 5*-  @  *+! ‹
 
È¡ W",! . 
¡ . @  N   .*1  
 N  , 5 "    F /!>]
  ”I Ì  .×& 5? .=.  & @ /"? h .*+  
# 
 ? =. # @  

œ /
#*1 <## @  d .;! .! .;  N jhâðeÊ{ Ì Jeoׁ *1
 *+! .
œ  !h]
  • N  ,

\( h_
 4 Z  ðf$
# 
Ñ-
 o”„uI

54
Au moins PII, 128Mo, JVM 1.1.8 et plus, Windows 2000
55
Source: Diagnosing J2EE performance problems throughout the application life cycle. MERCURY INTERACTIVE,
www.mercuryinteractive.com
56
Pour plus d’informations sur la signature de cette méthode se rendre à l’adresse :
http://www.jakarta.apache.org/tomcat/tomcat-5.0-doc/servletapi/javax/servlet/http/HttpServlet.html
57
INTERFACE en majuscules désigne les classes d’interface et non les méthodes et les propriétés.
58
Le package javax.servlet comprend une INTERFACE SingleThreadModel qui permet de créer autant d’instances de la
servlet qu’il y a de requêtes entrantes. En règle générale, il faut éviter l’implémentation de cette INTERFACE pour ne pas
épuiser rapidement et vainement les ressources du serveur.

©Kamal AOUDA 2005 www.kamalaouda.com Page 26 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

efG=>=# Ð C?€


 <*(gŸ) @ "! 9M M# @  d .&– - N _P
.M
lÐ?]   
 , 5 "   :",^ ‹
#*1 <#r , 5 "?r .  , .q*+ *( # A"!#
9‹ N  ! . ) 
A

."? ?  @ 
F 
/ , q
?  Z
&c
V $
# 
W !  
! ‹
r"$ @ ±# @  d .
?]   *+! 1#
Ü IXk‚‹"?¡",! .€! .&^
 S?]   S , 5 "   gP ¡!>]
 
 N 
.   @  4 Í?+", 4?
#"?4 H #
",*1
  +( ? 1",? . 
 H #  *(# I
Ñ   
# … .*1F# !q
"? ?? #q Ð
?! T# @  d .q$? > a9T :!>]
 
(
3.
  ‚"#

IpJ‡ ¡ ! \!T=. #gg
 Ü,! (
‹",*1! . \T 
! ^D ¡*+ $

!>]
 "?~5ƒ @ 
 , f ?] @ 
! 5*(  @  *+! f ",! . 
•
#<   /"#   ; 
!>]
  )I Ì  . @  G",! . #*+! 1?€P*+  $

 S 
 ~.ƒ/ 1 , #. _ ~.ƒ @  ^ P?!

 
  @  N 
 a!
 F=. 
F ["B_ " aF]
 [c [!>]
  ”&œ :*+ $
a!>]
 "?~.ƒ
 , / ?] @ 
G! 5? l=.  @  N  p_SLQ# @  d . l! #.! . ¡SC. ! R_
 =>=# #! .  I
Ì ??"  &",
 "$ ! )&
",*1? .
œ?€/*+  $!
 ;  " 
?!  @ 
 *4
 *+! .!
4.
 N jhâðeÊ{ Ì JAe {  .>o”ˆÓ
Ç*+   #Ç  .*1! @  N     ",?*1*+! ± ]!
N ?] _ h›)#
"?] Ç  r# @  d . ͛”# ! q9›#D R!>]
  ”IpJ‡ > .D*+   .¡ g!.&
"? 
! ”& >   ! . @  : œ q",
",!  ! Ê c , ) "H  c
i ! .#"?! .i  
# @  d . ͛Ê# ! /*(! ›# ]
… a!>]
  ~)€ *1
 …
=h=#
"H # ‡‡ 

  /: *+ $
a
{  .)~.ƒ
 [! $!  =) ",  F: N !    ? .
×&f
F]  
  F

+ ">_
? 5
Z+ \


 ?ƒŽI
è( ? œ   
.;
 ",?€1",*1? .
51#    "H  ] *+? 4 
!  9 ;=) 1 
5.
*+ $
4
{  .)~5ƒ ", "
 • 4 .*1- # !!4 5 5H ;!h]
  ?€;*1
  
  
# @  d .  @  N   š#
Ü, ht׏…]
 Ú  L" 
?! Q *1
 *+! 5! [ N jhâðeÊ{ Ì JAe±{  .…~>] 
 
 
  f3Hƒ'I

Snippet 1: Exemple d’un compteur associé à la méthode doFilter() d’une classe qui implémente
61
l’interface Filter
#%$&' ( )+*-,"( ./.,101( ' 24357698:35;*' 3-2=<>3?$%3@A215B3?$%3@A2DC
8E35;*' 3-2=<>3@%#,1F@G3H5B3@%#,1F@G3IC
01( ' 24359J+KL1( FM)%KL1( FN"2DK%5B,-OP@RQ SUT"V-)G3"#W27( ,1FC
8E35;*' 3-2=T"V-)G3"#W2D( ,"FMX
' ,"F-YZ&3%[4,5B3Z\H8^]-@A243_H` )-$575B31FW2;a:( _U3"bR( ' ' ( @-6"NdcAe e)G,"_R#W2B3$5

59
public void init(FilterConfig filterConfig). public void doFilter(HttpServletRequest request, HttpServletResponse
response, FilterChain chain). public void destroy()
60
Nous rappelons à ce sujet que contrairement aux méthodes init() et destroy() qui ne sont appelées qu’une seule fois
dans le cycle de vie du Filter la méthode doFilter() est invoquée autant de fois qu’il y a de requêtes entrantes ou de
réponses y afférentes.
61
Source: Jack Shirazi, Java Performance Tuning, 1st Edition September 2000 , ISBN: 0-596-00015-4, pages 496

©Kamal AOUDA 2005 www.kamalaouda.com Page 27 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

)%KL"( F` .,10I( ' 2B357675B3?$-3@A2DC-5B3@%#-,"F@G3Ndc


' ,"F-Y/L-[ 2B35I\H8^]-@A243_H` )-$575B31FW24a:( _f31b/( ' ' ( @-6"Ndc

g ©ª(£¤.æ¹ ©hcÖ J‡ > 5: . "$ 


 @  r ! Ad ##r
 c Ï pZ  .  !
?€   
FilterChains
@  N 9; 5! . 1  1*+ $
 (  !>]
  ?  ;1! #
 @  N 4?5  Ið! .=. 
& 
=.!  N !    !A9‹: !" ! i ^ T
…",!?*1*+^ 
!   *+? i  c# ??
#"? a
!>] 
… c…",! @  ! c
  !:  M#  
 5 5G=) ?€MC_š  " ! c M .*1
N €
"!  +",?*1*+ ;!  \",*1? .
. I
g © ª(£¤.æ¹ ©jiFÖ 
  /b : ! @ 
  *+! ‡=>=#
"B    …*+d*+ …*(  
#  @  
v v

Ê  !>]
  >
IfefF!=>=. ‚[*(*+? ‚c 
Z
 .  &‹ [",? . 
 .B=.*(
5! . F  b !>]
  5FÊ c
  N 
…*+
",
  *+aF .     ]!! ‚c  
v

 "??C
Q#  > 5 #C .*1. #C
! a Q"$ *1 C ,  =h=#
"H . C9š N  > #) 
! /

",! .€! .Ÿ. ] €I !>]
  ”I ",! .€! )I .*1 ~ Ì @   @   F =>=# # "? Bt”6+
#< F: ! ‡
 "

??"   (*+d*+ \",*4! .
.^?€4*+  $
 KŸ. j“
 ~5ƒŽ& kBŸ.  h]
 "?~.ƒØÝFƒ

Figure 9: Translation des JSP en Servlets63

Ñ   
#… Q .*1!Q# @   Q
…#  _ … Ú# @ d .ÐQ",! .  F!>]
  ] .Q 
(
6.
",! . 
-eb
OS~)€ *1
 q  N 

  ",  T!    !T", Ÿ. ! .*+? pð*("H Ú",*1*+
",! . 
+!>]
  >-
b
O
?-",*1*+4",? . 
N eb
OƒŽI
Ñ   
# ¡ .*1D# @ 
 ¡
 P"#   DG N eb
Ot)žÊs- S",*1! .  @ 
Ê!5 49L 
(
7.
*+  
#  ! d # 
 "? 49
   
.-. 5\  
*1*+? - h_
 4N eb
O[!    ! t”o
+",."B .<#;
 \+*( \ , #) 
 4  N 

  ",  ?t”tuI

62
Différences qui ont trait à la syntaxe et aux noms des interfaces.
63
Source : Jason Hunter , William Crawford, Java Servlet Programming, 2nd edition, O'Reilly, ISBN: 0-596-00040-5
64
Un EJB est crée lorsqu’il acquiert le statut ready et que ses business methods deviennent invocables.
65
Session, entity, message-driven beans
66
Répartition des EJB sur une ou plusieurs JVM.

©Kamal AOUDA 2005 www.kamalaouda.com Page 28 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

…€ *1
 ì ;
 ì

  ",  К",*4*+.",š  
"H .
 @  V?    !V
Ð, 5 .  ?
v
!  ?  :  :
p  . … 5
  [N *(>  ?!*+! ‡N 
:
#d A ", #~J‚=×I=) Z
#
`
3,2 ƒŽ& ! 
??" ‚
 ",*1? .
•9a F*+ $
͟) Jp#  .~.ƒF /" 
?! 
O• 
~#"B=”I 
 
  ‚0
ƒ'I Ì  . @  : . @  N 
a"  ! *(: c"!#   F, > .  ?a  
"!N  ,  *+ $
;"#  .~.ƒ;$*+ ! .>=."? @  N   ?] @  19 "$.Z
•  ",! .  
`
eb
OUÚ#  ) Z…~>=.h’A.
?ƒc"? h .Ú ?]",  G] .Ð Ú*+ $
ì͟) Jp.  .~5ƒ.tׁØI 
"#   šì, 5 .  ?Ú ô N  , c
 "ì."$]
 @  N 
#< Ú N  ?]",  šU 
*+ $
4͟) Jp#  .~.ƒ'I

68
Figure 10: diagramme de classes d’un EJB permettant d’éditer un tableau d’amortissement

Snippet 2: Exemple de compteur pour mesurer le temps nécessaire pour l’instanciation d’un
stateless bean
( _R#-,5;2Gl4L-*-L-V` FL"_R( F-Y1` J,1FW243%VG2Dc
( _R#-,5;2Gl4L-*-L-V` FL"_R( F-Y1`;Q F( 2D( L"' J,"FW243-VG2Dc
( _R#-,5;2Gl4L-*-L-V` 57_R( ` m^,5;24L1&' 31<h3_f,-2B3Sf&nl43)A2Dc
e eI' 3@U( FW*-,)GL-2D( ,"F@p@G,"FG2I#,@G@%( &' 3@pqr#L5;2D( 5".3r#' $-@( 3$5B@2 ]#3@p.3/)' ( 31FW24@f6B@G35;*' 3-2DCTIstuvN
o o;o
295;]
X=J,"FW243-VG2^( F( 27( L"'W\ZF-3-OwQ F( 2D( L1' J,"FW243-VG296BNdc
Sf&nl;3)A2","&xlB5B3-[I\Z( F( 2D( L1' ` ' ,,y$#%6Bz;l;L-*-L1{ )G,"_R#We431FW*Ge43Al7&We7b]|-,L"F-zDNdc
|,L1F}>,"_f3rK,_U3H\
6D|-,L1F}>,_U3N~m,5;24L"&' 3I<>3_f,-2B3Sf&xl;3)A2D` F-L575B,-O6B,"&xlB5B3-[DC

67
En fait create() est une méthode abstraite et ejbCreate() correspond à son implémentation dans la classe LoanBean
68
Source: Gail Anderson, Paul Anderson, Enterprise JavaBeans Component Architecture: Designing and Coding
Enterprise Applications, Prentice Hall PTR, 0-13-035571-2, pages 456

©Kamal AOUDA 2005 www.kamalaouda.com Page 29 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

|-,L"F}>,_U31` )%' L@G@GNdc

€ "‚-ƒH„%…-†4‡B…ZˆH‰^Š-‹AŒ4…" ‡7‡B…"‚GŒ;E‘ f…"’/‘ € € ‘ ‹-“"”d•A– – "  R—WŒB… ‡


o Ž- Ž 
˜-™1‚U€ ™"‚šI›œˆZž-"f… ‡B…™-ŒB…“7”d•

€ "‚-ƒ/™%† Œ4…‡^ˆH‰^Š-‹AŒ4… ‡7‡B…1‚WŒ;:‘ f…1’U‘ € € ‘ ‹-“"”d•A– – R—GŒ4… ‡
o Ž- Ž 
€ ƒ …"„ ƒ“9  ‡B…™-ŒB…H‡B™1‚U‘ ‚¡ ~¢“B™-†;Œ4…‡I£:„%…-†4‡B…”7”d•
oŸ  Ž
¤
)GL-24)%KU6=T"V-)G3"#W27( ,"Ff3-V-N1X
¤
o o;o

{
*+! 5 *+! œ"? h . .
"$

 @  *+  
# ??" F
",*1? .
•?€*+ $
  @  
 a",! . 
‡ ?] @  …
‚Z #‡ a"B_ " F/]
  Feb
O‹~#"!N  , 9a #…  *+ $
 
 N jhâðeÊ{ Ì JAe…eb
Oò‚*+t”ˆñƒŽI

ef  l ! (d #gZ  .  ?


R?€‹H 5 .!=)
! ?  R  T? Ê
 D 4  g ! .h=."? 
`
 ",  ,”a~ ",iò‚*+Cj“? .h=."? ƒ @  G   ¡ ! .h=."? g , 5? . H'%/~”*( .Lò‚*+
j“! .>=."? ƒŽIcâ‚; *+ > 51 5? .=. 1 # !>]   @ ! •9?/!    ?    ] 
"   ?  “_
  …#"? @   N  ?]",  [q 
A*+ $
c Ÿ) Jp#  .~.ƒ^
. ] @  a!
 *+! p 
"#   N 
F  F*(  Z
 *+!  N  !5  N 
F?] 

# Z , #*+! f
/ …
!



 [9‹  @    r œ , p


?! IJ‡ q ”&K!
^  [, 5 .  ?[! ?  : i  …!  “_
  ; *+  
#1
 d #1=>=#
"B 
1! 5? +=.  @  N  Í_+ N  , 5 "? -
4 N eb
O…
,
",! . 
”I•ef#] "$ F
K   H 5 .!=)
 ! ,  F    
 œ!=. #/! 5! œ=. 
@  F N eb
O: ,  ?] @  F ‚  ;"  ! 5,)6A

  @  F ",! . 
f"!#
F
 F?]   F , 5 "?
  N eb
O9;"$ @  ;?]     ?]",  I

“j   ,  *1> 5! •a . @  a / .


"$

 @  a # !! 5
/
  
 
  •0[ F ! ‚
 d #
*1
  _
[
K …*+   . .*1",?*4*+ aK N  , 5 "   N 
a*+ ??
Z) ] 
  I•ef/=>=# ”&9… F =>=# # "?  ! ?  / !  h_F  
&  /*+ ,?
Z  ) ] F  
 N €

!! p
N  ! .h=.
"? [ ",  a , 5! . /9q 
.F"  ! 5 I‚‚
   @  *+d*+
N   C *1
 *+! .! a ì*( $
Ð͟) Jp#  .~.ƒ:  G*+ ??
Z P) ] Ð  !C ì ?] !
",*1*1

 @  ^ ] 
" 
5"  ! 5 @  N 9r #. ] .T q!>]  ^g*+ ??
Z c
H_
 "$
.  ,”E
~5 h_

 @  *(!
b
Ñ(•ž'ƒŽIJ‡ h 5 >  "
 ) . ^*+< 49 *+  
# Z
 *+! )s

69
Le conteneur appelle ces méthodes pour gérer le cycle de vie des EJB.
70
Invocation de la méthode create() à partir d’un client situé sur la même JVM.
71
Invocation de la méthode create() à partir d’un client situé sur une JVM différente de celle où se trouve l’EJB.
72
Par exemple une servlet, un autre EJB ou un serveur JMS
73
Ces messages sont placés dans une file d’attente (Topic ou Queue) pour ne pas obliger le client à attendre la réponse
du bean (Contrairement aux invocations qui bloquent le client tant que le bean ne lui a pas retourné une réponse).
74
Java Messaging Service

©Kamal AOUDA 2005 www.kamalaouda.com Page 30 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Ñ   
#+ T .*1T# @ 
 r
-,] _ (
‹*+ ,?
Z‹r"  ! h)o4] .r R  g~)
(
€ *1
  
 N
"$Z *+ ??
Z 4! =. ‚ N ! #*1 !b
Ñ(q/ ! œ", "
 
 … =>=# # "?…! #:
a",*1! . K
??" [9 *4 $
[Ñ( ??
Z~.ƒp[  a Ê

! #S
??" P9C Q*+  #$
C


   $
~.ƒ/L L" 
?!Sð
 " 

   $  l ",#L 
v
*+ $
+!~5ƒ; ;"  ?!GÒ(  
>)tfƒŽI

e  ?] .!*+! )&*+   #  .*1 # @ 


 
œ,] _ ‚
*+ ,?
Z/ 1] .  
"  ! ~)
"? M i ?=>=) N  ?] .! N *1
 "?*(!  S",*1? .
.P
#  
 *+!
" . ?ƒ'I

77
Figure 11: Cycle de vie d’un MessageDrivenBean

Ñ   
#( q .*1!T# @ 
 T
 .,] - N *1
 "?*+!  reb
OD]
 rb
â‡kpj )„~)
(
8.
€ *1
 c
… : 
 
  ‡0T  ?=>=) ‡q
 "?Ê a",*1! . .F ]! Ê ‡
#< — 
`
  Z 1è( Ÿ#
"H  Ÿ#:= ¥ 
   I“ 
É?

~D¦“Ÿ. ]s "H*1H›?]H›͟),›×Ñi_ 
"¦)ƒ¨§ ƒŽI

Ñ(  
#×&‚
  F! ?  … A  a!  h_:  F
 *+! ”&‚ … .*1…# @   …

9.
 N  ?]",  C Q*+ $

 Gš N  ! .>=."?šeb
O•è- Ÿ#
"H F",*4*1
 *+!   
 

    ?F*+ $


!F 1Ÿ..Z
 aeb
Og~.
F N € *1
 ac F=) Z
#T3,2["? 
 ! T!î=. #Yî

? 5! g Y 
 
  T0Y?ە*+ $
 î*(? $
 _  _
*+! #~.Ė&
v


 Ì *(5 >ð
 ~5ƒŽ&*(! $
 _ Ì *(> >ð
 ~.ƒƒ'I

75
Servlet, EJB ou tout autre classe Java.
76
Selon qu’il s’agisse d’un Topic ou d’un Queue.
77
Source: Gail Anderson, Paul Anderson, Enterprise JavaBeans Component Architecture: Designing and Coding
Enterprise Applications, Prentice Hall PTR, 0-13-035571-2, pages 456
78
Nous rappelons à ce sujet qu’avant de pouvoir invoquer les méthodes de l’EJB le client doit trouver son emplacement
sur le réseau. Cette responsabilité est confiée à l’API JNDI via un mécanisme de look up. Pour plus de détails voir snippet
2.

©Kamal AOUDA 2005 www.kamalaouda.com Page 31 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Ñ   
#  .*1# @ 
 
 5
   F",
 €
  ] 
" [
!/


 ~#
(
10.

??" ! Úš€ *1
  
™",*1! . ì9   *+  $
–Z #JK
 
"H  
~.ƒV
k‡) ] ”Ñ-
Z.ƒ'IFOf MÏ
c"? h .ô*(  
#š
 [d #Ú!=>=#
"B 
ô
a 5? 5 ì  
",
 €
 +
 "?
 \
!+ 1",
 
"B  1
 I
Ñ   
#R U .*1ô",!?*1*+ ±R N €
"!  ôN 
 W# @  d .&c N  !5 # &: 
(
11.
*(
 =) ",  (1 1 

 # ?  (N 
+
# Z , #*+! ~)€ *1
 1(
??
" ! 

",*1! . A#   
"H  ] *+? K?€…*+ $
 € 
"! . Ò( >_ ~.ƒ ‡€ 
"? .8‡
 .~.ƒp
 ;" 
?!1œ 5 .*+?  ## œ 5 .*+! >ƒŽI
v
Ñ(  
#[ C .*1C
"? ?? #ì
[ N €
"!  LN 
 ì
."? 
#Q, 5"ÉB
ì~#
12.

??" ! z€ *1
    ",*1? .
.½?€ *+ $
  € 
"? 5~.ƒ 
€ 
"?"! .8‡
 .~.ƒ; ;"! 
?!;JK  
 
œ 5 .*+! >ƒ'I
Ñ   
#‚  .*1!
"? ,? #F
‚ N €
"!   / N 


    N 
  .?"H  !)ˆ
(
13.
~)¡€ *1
 ȱ
??" ! R Y",*1! 5
.W.   
"H  ] *+? R?€È*+  $
 
",*1*1 ~5ƒ• .  "É?~.ƒ ; N  Ÿ# JK
 
"H  ƒŽI
b   @  N  "‚c ]q
.
! g
 g  , .gr  *; 5  ] Tg*+  
# q
! Z*+! .- 
.*1Fq# !!… 5 5N 
 c

  ",  :!    ?! A  F!>]
  5…  ceb
O‚&œ A N Ì j•b
kÊOœJI
v
k‚4
 1

  ",  ;
 (",*1
 < . @ 
! ! .< Z#1N ! # (",*1
?? 5(" \4b!0ee‚& "? h .
  , .  ! d ##1  . 4?€1*+  
# ^ 
 ]! . 4s
`
+ .*1(# @ 
 +  .?] 
- Ÿ# ;  
-
  #„׏]
 
 ;# @  d .+b
â‡kpj>I
• `
+ .*1(# @ 
 +  ?]! @  
- Ÿ# “„Ž% , 5!  N  ! .*+   #4‡Ñ;jhI
• `
 .*1
,! …‡
*+ ??
ZF H_
 "$
. F

ð
 " F
/Ò( b
Ñ(

~5b! ]Ñ( ??
Z Z1>]
 ", ƒ ]? N d ##+   ]
# 49  N  Ÿ#  ,   5 #I
`
+ .*1(# @ 
 +    ]
#
(", ))  ]
 4b! ]Ñ-  I
• `
1 .*14# @ 
 1
œ N ! $ !  =) ",  1 • N ! 5) ,  4N 
 !    ? .
ϥ 
  

(!>]
 "?(b ÌÌ :~>b! ] Ì ! $ !  =) ",  ( Ì ? $) ö!  (!>]
 "? ƒ'I
`
+ .*1(# @ 
 +  ?]! @  
-!>]
 "?\’i\]
 +b Ì Kç' JI
• ` v
V .*1Ú# @ 
 V
T N €
"!  î~#",*4*1 5ƒTî N 


   î~).  " ÉBƒrN 
 

.?"B  \]
 +b?ð•:~>b! ]!4ðf.?"B  +h]
 "? ƒŽI

79
Transaction de base de données et non une transaction Web.
80
LDAP par exemple
81
Objet placé sur une aute JVM

©Kamal AOUDA 2005 www.kamalaouda.com Page 32 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 =)# @   "?C G*+ 
# S
 F#!=) .a Ð"$!.ZCL . ]  @  M N 

  ",  G!.
L
`
*+
9: 5 .p
: N ?]
 .
 *+? pr .
"H  I  c*( _ 
  a) $
*+   @   H„”6
 4#  
 5 5-? .
\
 ] ! d #1",*1
 
 -
+
( 5
  + .1(=5Ü,+9 "? @  
  W ]  
 
.Ç

 ,!! P# #L5
 *+! G  ï=).
Z*+! >WŒ",
 @ 
:?!
#  ?
  ;  *1!
,!   œ 1Z

  5;N #.Z *+! ”IOf  ]
 *1*(! • 5? .   
"H   @  N   *+< ! ^
i",)) Z\  …*(   # ]
 …
 ] ! A!q? \ 
.*1^;# !; ?=# ) 
.\( Z
?€-?€1  "$ *()ÉB(
# !! . ^
( 1!
"H  -0I.3I
â‚F
.
?" ç)
#< F
a*(
< a  *1
  =) a 5
  c.: Ê  /",*1 ?! 5
@ 
c#! ##! ¡$
    *+! ‹
± È",H )"B  YN 
 W

  ",  ïX",*4*+#"?
 
"H .
 @  I-k‚R
¡
.BŸ# +¡ ]  
 *+! ;#
 &"?S*(
< ¡
 +d #DBŸ), . l
.! ",*1? .+^’É =) ’(&-; N #"$
 .
"B 
#4 
 \! ## \",*1
?? 5^
  N 

  ",  I

Tableau 8: Modèle de tableau de bord simplifié pour la segmentation du temps de réponse

Références de Cette case sert à indiquer le nom et les autres références permettant
l’application d’identifier l’application et les fonctionnalités mesurées.

Cette case sert à indiquer le cas d’utilisation pour lequel on souhaite effectuer
Cas d’utilisation
la mesure

Benchmark Mesure réelle


Temps total nécessaire
pour la réalisation du cas Cette case indique le benchmark Cette case indique le résultat final de
d’utilisation associé au cas d’utilisation en la mesure effectuée pour le cas
question (Cf. section 2.1) d’utilisation en question.

Interprétation des écarts Cette case interprète les écarts relevés entre le benchmark et la mesure réelle

Détail des mesures effectuées

Composants Interfaces Cumul


Résultat en
/ Jointures/ Mesures possibles associées aux des Commentaires
ms
API compteurs résultats
Temps nécessaire pour
acheminer la requête du client
Jointure 1 Fichiers log - - -
vers le conteneur

Temps nécessaire pour la


création et l’initialisation de la
_jspInit(), - - -
JSP.
JSP
Temps nécessaire pour la
génération de la JSP. jspService() - - -

Temps passé par la requête/


réponse http dans le FilterChain
FilterChain doFilter() - - -
avant d’être envoyée à la
servlet/client

82
Somme des temps de réponse pour un composant sur le nombre de mesures prises pour le composant en question.

©Kamal AOUDA 2005 www.kamalaouda.com Page 33 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL


 .4\ 5
  ( !.

Détail des mesures effectuées

Composants Interfaces Cumul


Résultat
/ Jointures/ Mesures possibles associées aux des Commentaires
en ms
API compteurs résultats
Temps nécessaire pour la
création de la servlet init() - - -

Servlet Temps nécessaire pour


acheminer la requête/réponse
service() - - -
http vers la servlet/client

Temps requis pour établir la


communication entre le
Jointure 2 conteneur servlet et le conteneur Fichiers log - - -
EJB
83
Temps requis pour créer, activer ejbActivate() ,
84
ou passiver un session ou entity ejbPassivate() , - - -
bean ejbCreate()
Temps requis pour envoyer un
onMessage(),
message asynchrone à un - - -
EJB publish(), send()
message driven bean
Temps requis pour trouver
lookUp() - - -
l’emplacement d’un EJB via JNDI
Temps requis pour appeler une Méthodes de
- - -
business method EJBObject
Temps requis pour établir une
connexion avec la base de getConnection() - - -
données
execute() ou
executeUpdate()
Temps requis pour exécuter une classes
- - -
requête simple ou pré-compilée Statement ou
PreparedStatem
JDBC
ent
execute() ou
executeUpdate()
Temps requis pour exécuter une
classe - - -
procédure stockée
CallableStateme
nt
Temps requis pour exécuter ou commit() et
- - -
annuler une transaction rollback()
`
 .
"$

 @  ‹R*+   .D
# !? .
‹
"? h .r!
"H  r H A=."  ‹9¡*( > ##gT?] #
‹
 . @     \

  ",  -?! Q   .+ 5   1 @    
.-",*1
?! 5\!+ #.?] ! ?+ 
*+d*+ab † Ñ1I‚k‚a  

  ",  …Z.a 5    @ 
! K F",*1
,! 5[ ! . Z# 9

 4#"$
 . "H  #4 , #) 

1"? h .;*+  $
  # !? .   +  *1 . \ 
 ]? . 
s

83
Entity et stateful session beans seulement.
84
Idem.

©Kamal AOUDA 2005 www.kamalaouda.com Page 34 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

â
"? ?  . ;#
",*1
  ×&
#< 1 N  !5  4 +",*1! . .
&  ",
;? #"?11 51  


",*1
?? 5D
! ;l,
$ .C*+   #/ Q h=5)*( "?I\è("? L H 1 =>=) "  l] 
 *1
?  
 /9[*+ h #  ©?]
#a . @  a   ",*1!
?! 5;?? ‚
 $) @   1 . @  
 c ]  
 
 N T
a"?"?< F9T 
p",
c?
#"?„”ouI 
p",! 5
) p"?q
.
 <*+&
v
"?5 5 G? .
5B„”t½
.!
!! N ?]  
 [~h’\5

 Z
ƒ  L",*1!
?! >G
! 
?
$ .F*+  
#‚ a >=5)*( "?9a N  ! . ) 
œN 
/*1
#F# H # ! •N  Ÿ. 5
. €?_,„ׁØI
J‡ > .ï .
"$

 @  X *+ ”&c"?> .  &…X# 
 #X X*1
#Y±",*1? . .î±  
"?! .  ?! î
   w Ÿ# 5 
. €?_y*(     ! .,'  
  ",?*1*(  
 


 *+! 5 #+ (# ?,
#"?  @ 
, ! 
  !  +#  
 5 5=) ?€I
`
 $) 
Z  /*("$
    
‡   @       "H*1
?! >?! 
 "?  
 ] ! ‚d ##

H_
 "$
.
 !
  I
`
ì .
"$

 @  V V ! …
Qd #š*1
  _
V
[ 
>]    :  M h=.*( "? C

 N 

  ",  GC
$
!CÐ
.
 "H  g~)#"? @  Ð  G*+ ??
Z l =>=) "$ GF  
",*1! . .( ?] ! Zd h›# .! . N !    ? .
.ƒ'I

2.2.1.2 Utilisation d’un profiler


`
 a
 
. =)  .?!  !    @ 
*+  
#? Ê  h=.*( "?[ /

  ",   
?  H .!
`
   ]  
 
.
F N  !  =) ",    =).
Z*+! 5[",
c?]! ‡ … Z.
”I  

. =)  .;€
 , 5? •"H    *+! •  ‚ F*(#"$ F# <!] ! •N 
 /
   
.; ;", . Z
)  
 
 ]! . 4s
£‹³
¤#©ª1¸ µ¤#©", . Z
) c=5 p
 ?€a=. "H  
  . [r*(
 5) Zq ͟.9r ! . Z#
 a9‹ 
ß
b † Ñ;I efP=. )&  Q ]  
 
[ N š
C  ? LN 
Ð
. =)  [ ",", ?€L . 
=. "H  
  . 
I•k  
*1*+? … ] 5  a!    !
&•  ! K  *(
 

 ‚ #
"H .*+?
`
f /
  + ; ! .h=."? (b † Ñ j „”„T4b † Ñ\ð‚j „”ˆuI N 
5  1
.=)  .+"? h ./
#*1 <
v
", . Z
) 4!4   1 ,!! #   *+! 1
 ]  (  N !    ?
   . 4 + ! .>=."? (~Š(8pj ƒ•   
    
   . 4 +#  
 5 5 I

85
Par exemple lorsque l’application utilise des composants commerciaux à source fermée (par opposition aux
composants open source).
86
A l’adresse : http://www.onjava.com/pub/a/onjava/2001/12/05/optimization.html, Jack Shirazi auteur du livre Java
Performance Tuning propose une technique pour envelopper les principales classes de JDBC.
87
Objets mandataires qui reçoivent les requêtes destinées à d’autres objets avant de la leur déléguer. Cette alternative
permet de réduire le nombre de compteurs.
88
Pour la JVM 1.4 et les versions antérieures
89
Introduite dans la version 1.5 elle est plus robuste et consomme moins de ressources que JVMPI.

©Kamal AOUDA 2005 www.kamalaouda.com Page 35 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Figure 12: Interactions entre le Profiler et la JVM

»7¼½

®d¯"°>±%² «´³ ®~¯1°^µ%²

ª«n¬x­ ±-¾ «¨¿ À Á ­ ¾

¶· ­´¸º¹

k‚[ [=) Z


#‹3H0& .Á … N 
Z! ‡ , …Z #A :",*4*1

 ",  [! . …b † ÑV p 
. =)  ‚ 5*1*+?  . @  /"?)
 f ,  , 5   
‚
 F*("$
   , 5! 5F~”‚
  
v
@  c N  , 5     v . =)   
‡
 …*("$
  a =h=. #! .aa"?  ac N 

  ",  [ *+
V# 
 #V Ú",?*4*(  Ð Ð# ?? #"? Ð~)*+ *( #&J 8iÝFƒ!Z#
V: 
v

."? ? aT*+   #IJ‡
" 5! 

. =)  i :
 
[",?*1*+
 a7m±

# ??
#"? \;  *("$
  + . H .
!ˆ××ƒŽI

£F¥©¹?§
¸ µª+©F", . Z
) a
. =)  .!    !/ 1 .
"$

 @   ;a*+  
# @ 
# ?!*1
 ! œ9
ß `

 S l Z
.
¡9C"?   P
# !! .
 ¡
P L!
"H  S0I 0I.3 I 0I  P*+
",
  *+ ¡
=. "H  
 *+! ‚?? ‡ 
*(  =>=# #! >F#"? @  c  /",*1! . .[", > .a?€
 <*(
", . Z
) +?! s
Š^  # ^! 5*(  @  *+! ”I

j“ Ÿ#
"H . ^ #
"H .*+? 
!+  ?_? .1",
+  N 

  ",  I

O
! \ 
 ^ Z
) $ *( +
 -  #  I

è(!  *1 ! + # 
 #  ;",?*1*(  ( (# ,?
#"? ^(H ) "B *1 
 *1 * I




) *+ \? 5*(  @  *+! 1?_? .4",
  5 @     (*+  
# ^??
.*1 
 
I

J *1#
?€F . =)  . @ 
!    !!   / ! .>=."?  [ b † Ñ;&", h .?€
 <*+F", . Z
) 
K
",?*4*+*( Fq# ??
#"? …#"? @    [*+ ??
Z a A  a ]  *+! 5Z  # 
*(
?  ] *+?  4b † Ñ¡?!  ?"B  ] 
I

90
Source: Ali Syed and Jamiel Sheikh, Java Doctor, Manning Publications , Spring 2005,
http://www.theserverside.com/articles/article.tss?l=JavaDoctorBookInReview

©Kamal AOUDA 2005 www.kamalaouda.com Page 36 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

â  5A   
. @  r  
.=)  .…r g
#*1 <#T", . Z
) r c=.

 ?!! @  q 
‚
*+  
# -Z  .  4#   ]  (9/ ",?*4*(  4
 1# ?? #"? BˆŽ%• . @    ?€
 <*+
", . Z
) / )*+ N 
??
"  1*+  
# 1   "H

 4" 

 +?€1 =>=. #! . +" 
?! 
  ! .>=."? \; N 

  ",  I
`
 g=. "B  
  . DC G¬¤.¦¸ ² ¸ µª+©G·,£ ¬. »
¦¤)¸ ©P
C
. =)  .R?!  ! . Z#  Dl!>] 

N 

  ",  Ief   +?! Z  . *+! ","? ?  
  -]
   Ì j @ 
?!/
! /
 4
` v

 … 
\   b! ]RÑ- Z*+! \e€? .  ~5b / Ñ Kƒ I‡~ : 5
  ù:=. )
 i
 ‹  , .‹
€
$,  ] 4;
.

 5+? #   ?! ;b
R Ñ :ƒ'I
b
ÑRP!.q
# !! . :.
 *+! 
[ c 
 .[…"? h .…!
"B  IfJ‡ h . # !! 5  a!.
  *1 .
/9?#"$
 .
"H 
./Z  F œ?€
?  
   . ; =>=#> .  *(  <#/ 
>]     "?
 + h=.*( "?  I
92
Tableau 9 : Liste non exhaustive de produits utilisant JMX

b
ÑRÓ , T
ì=.*+!’)É @ 
/ )*+ :N 
*1 
 , ##q :ô 
h]    9î , 5 "?ô 


  ",  Cb! ]&*( Q Z
 *+! :  Ð",*1 ?! . ì*( . )    QN 
Ú# ! Ú~ J&
v
!>] 
”&K.! . ×&hI>IhI ƒ'IKJK*1*+r ‹*(? #r :=) Z
#D3 &‡  Ñ1O• :~*( Z g# ? #"? 
­
Q*(
Z*+!  !?ƒ/!l .,] ! ;l%" © ;G"?¡=).*+!’)É!I1j“ D",)#  ?
", "#< .*+? 91 ib! ]!O•  @ 
? *+ h .!
91 \ Ÿ# 5- ") 5\-b!] ˆ×Eœ4  
!
N 
 c ! .>=."?[",! .! ‡  F ?=.)*(  / ‡  F ]
 .[",! .Á c "? ?? # 9: 

`
 
>]     "?1 9 

*1 
 , .  I  \? # \"H*1
?! . -" ^^=).*+!’)ÉA?! s

91
Occupation de la mémoire, nombre de threads actifs, pourcentage du CPU consommé…
92
Source : Benjamin G. Sullins and Mark B. Whipple , JMX in Action, Manning, ISBN 1930110561, October 2002
93
Ces objets peuvent être aussi écrits dans un autre langage mais ils doivent être dotés d’une interface ad hoc qui
permet leur interopérabilité avec les plateformes Java.

©Kamal AOUDA 2005 www.kamalaouda.com Page 37 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 
 
Z! 5 @ 
 =.
)
 ?!!  !>]
 "? Bˆ)ž\
‚Z .l  FÑ1O• 
&*(  Z
 *+!

 +

! 5 .
.(/ . >",  ; *+ h 5! ^! _4","? f ", *+? 49 , 5 "?~)
`
€ *1
 4

 +
4
.’A!•òðfÑ ƒI
8  !>] 
ÇÑ4   >]  @ 
M=>=# "H  } N 
# Z , #*+? Y  Ñ1O 
&î 

‡

# =# # "?*+?   N 
Z# Z   S  
.+ ! .>=."? \   
.+*+ 5
ç)


 
I J‡   
#/]
   
   f€

  5
    
K a# ! ? !K … 
Z @   
" =) @  /  
Z! 5 &
?   \ =h=# #? 5\",  
"H .
.Bˆ”o !>]
 "?  @ 
, 
?? 
,?" 
I

Figure 13: Architecture des Java Management Extensions

Š 7Â"?:"ÉB
ZŸ. ] €I“*(
Z*+? ”I *(
 5”&
qÑ1O• c , p",
 : 
>]    i 
-
.*14",?*4*+ / 5;  4",*1
?! 5+N 
  

  ",  1",*1*+#",  
"H .
 @  
~5b &!h]
  ”&feb
Oƒ'Ifâ‚ >F   
. @  c a .Ü,
   . a =>=#5 .cb
Ñ/S , ‡*+   
#
v
@ M"?  К M?€
 <*+M", . Z
) К . =)  .Q#", @  Ð! l=."H  
  . G
*(
 5) Z…N .! Ê!a!
 *+? K?€a",*1!
?! 5: N 

  ",  c*( F Z
 *+?
?€G",*1
?? . P*( . )    lC# ! Iw8‡S! #L ]? 5
ZLGb / Ñ ±L . 9M 
",?*4*(  1 ;# ?,
#"?  @ 
! , •*( # "H*1.  ] *+? 9"?  ; ;
.=)  .+
 D", . Z
) g0IAJ‡ Dq=. +
 g .)  ] R=h=) ","?¡
- 
>]    4  ‹ >=.*( "? 
N 
 4

  ",  +1
$ !4  .
 "H  I

94
Monitoring, timing, relation et class-loading
95
En soi un agent ne dispose pas de capacités de communication. Il doit transiter par un connecteur pour obtenir des
capacités de communication via SNMP, http ou tout autre protocole

©Kamal AOUDA 2005 www.kamalaouda.com Page 38 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Ì ( *   @  a a


. =)   ",*1
   5! .  
.+=5 "H  
  . 
& !  
"H  a N 
 /
 N ! #4 \,"  . Z
)  + .
" .
 \] .1!\=. #1^=. "B  ;s

[
© ¨ £¬5£¸ ¨ ¨ ©¥©[¨ à £³
³
¨ ¸ ·,£ ¬¸ ¦«1© ¬œ¥©²?¦«/¥©
»¤#ÂF¥©¥¸ ²,¬¤)¸ ´
¹!¬¸ ¦«Ö",*1*+a N  ]1]
&
• ú
 P .
"$

 @  PS", 5*Ó , )
*+? 5  S , ; =h=) "  l] / *1
?  
 P9Q*+ h #G
©?]
#
/   Z. ;

  ",   @ 
 ! f  ",*1
?? 5/# 5     K
   
.
b † Ñ;I
©Ð¨ £M³
Ä£
²!©L¥¹L³
¤.¦ #© ¬œÖ1 . @  N P?
$ .C!=>=.
"H    P*+  
# lL
$
!L
• ú

.
 "H  R f=.? - ]
 .\N !    !4 R", 5*Œ H ) *+! 5    +  ‹
.=)  .q¡ 
", . Z
) 3; f0[#"? @  N   ",?*1*+?    "H
[# ??
#"?   fZ  <#! f 
*+ ??
Z Zd? 5F ‡ N !    ? .
×I•JK*4*+a K   
./"!N  , ‡  F
.=)  .c 
", . Z
) [Î @  N   =.! ‡
) ]
  Z 
/"? > .c
$
!I 
Ê 
Ê5 )&œ  F
. =)  .c 
v
", . Z
) :31 œ0?! • h_
  @  *+! ‚!    ! ;
  
$
! ;",


Z œ . , ”I•j“ 
  
!! -
- D
 
5 ig
 Z
?çñ  @ 
 *( > .? iR  ",? .Á i9D5  i 
?]
 .
 *+? 5\+ ]  
 *+!  ? . Z# (~”jhkÊeƒ'I

©:¨ Ã ¦´A#©
·H¬¸ ¶¥©c¨ £:ª+© ² ¹
¤.©֜  F
.=)  .c …", 5 Z
) T31=. )
 ?!! ‚ *+ #) @   
• ú
#   ]  -9 ;",?*1*( # + 4# ?,
#"? ~J 8p& *+ *( #&? $ # 

݃• . @     
v
! # 1", . Z
)  4
.=)  .  )*+ > 5!  
h]   •
  
#<   ",*1> .*+?
  N  *1> . @  H",*1 ?! ; N 

  ",  I

©q¨ à ¦¤.»
£«
¸ ²?£ ¬¸ ¦«a¥©q¨ à ©«!¬¤#©³
¤)¸ ²!©/֕   . @   *(
 5) Zc [ h=.*( "? F H
• ú
",?=) ±9Ç
   
.Y ! .>] ! 5 &q /=.! ‹! 5D
g Y
. =)  . @ 
F! ‹ 
=. "H  
  . ôU . ]! F",  .  =>ˆ”tL~#€ *1
 s )*+ > ##Y9± ô"H 
 5! 5
€! .)  PQ 
 ]
#Q9Ð , 5 "?ì C .*1Pì# !Qì N 

  ",  I Ì ] 5  [ 
k 5 .*(! ÐN Ì ? 
."?–Ò(  . zì",
)) D˜",
—™ Z.
  Ó 
 >=.)*( "? 
I Ì ,  Z G X9 Â"$  Ç?€—
. Z.*4*+
. ISe .L n.
5 5
N "H  ]
 . •ÝFƒ'I

ÃMÄ G
Ö 
 –  , .˜€
$H  ] Ó ¿
)  " ?€˜
5 =)  .n , C  
 
 Ó9w N 
# ?!s
$! > s ›h›>’Ê’Ê’(I b! ] h=.*- "? ðf

 ZI ",*i›”# ? #", 
I  $! #*1
v

96
La plupart des profilers de la catégorie 2 et 3 offrent ce genre de fonctionnalités.

©Kamal AOUDA 2005 www.kamalaouda.com Page 39 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

2.2.2 Mesure de la charge de travail en fonction du comportement des visiteurs

Ì ] ! ¡Œ",*4*+ "?P Ç   ZÈ P Œ",


 
ZÇn N 

  ",  &g  W @ 
   ±

 ]  
 *+! ‡
 ] ! ‡ ]  Ê ] 
"[ q
 FN  €"H  q
?  
 q "$.Zc… . ] 
@  N   ;!. *+
;9Ð . . 
$
!;
.
 "H  I
J‡ /  ! !4=. # @  ; ?   
  
!! N 
*(
<  ",*15 .*+? @ 
 #=) < ./ N  ?!!  ? ; ! .."H  4! #/  
]
   .
. .!     N 

  ",  IJ‡…*(
< F  ‚d #F  # F< / c $
!FN  _!
#"? @  N  ‡G
S *1"H ( #
"H + 
  N  *1
 *+! 5  RP N 

  ",  I(j“A
"? ?  .P
 
. .F",  .  ? .… N @ 
  FF ]  
 *+! g K ck > .*+! KÑ-)ÉH  Z @ 


 ‚*+ > ##/9?/  
    5! .   ;


 ;"H*1*+#"   
&B_ "$ 
Z @     œ?
" 
ç

",*1 @    @ 
+ ?]! / 9ì*1 ?€C",*4
##ì  C ! .."B  P l]
   .
.
 .!   \ ] 
"- N 

  ",  I
`
 q
 #
"$ #"$   @  gc ]:=>=#
"B 
 qc! \ )*1 cg#
"?!!-
r*1
#
# , ## ! Ú # !=# #"? Hˆ× @ 
L
.
!? š w*+  $

 
Z  z
î*(
   !î 
",*1> .*(! K ]
   .
. 
A
a  .…c",*4*+#"?c  
"H #.
 @  IfJ‡ a# =# # "? !

!! A
 T
 
> ‡

 c _!q#  .
   "H  ] c /=) "$
 .Fq 
Zc:
 ]  [
!>] 
’i; ›#1 
 ] 11!h] 
N 

  ",  IJ‡ 
? ”&
   ;;  
 ! •

&
",*1! .s

k 1 ! .."H   @ 


,! •  4?1#
",
.(?€ # ??
#"? (N 
4!>] 
œ~)€ *1
 

  \]  
  (;


  @ 
B=.! •

 @  *+! 
 ,9  (!") ! >+€
"? 5 (1", .
+"  ! 4  +
Z (*1 ! -(","$ 4
!+
4
5’!4
1 . €?_ƒ'I

k  q ! .."H  cZ  #  q-  q. 5Bˆ”„4


! \ r",*1> .*+? 
 p=. #g N  Ÿ#


N 
ï*(
< U9W5 r~#î=>=# ‹ 
! r
 U? ?  ô


ï"??€ç”"Z  <#!
   ",
1
 \;# @  d 5  @     (!    ? .
.($
 *( ?ƒ.ˆ”ˆuI

97
D. A. Menascé and V. A. F. Almeida, “Challenges in Scaling E-Business Sites," Proc. 2000 Computer Measurement
Group Conference, Orlando, FL, December 10-15, 2000.

D. A. Menascé and V. A. F. Almeida, Scaling for E-Business: technologies, models, performance, and capacity planning,
Prentice Hall, 2000.
D. A. Menascé, V. Almeida, R. Fonseca, and M. A. Mendes, "A Methodology for Workload Characterization of E-
commerce Sites,'' Proc. First ACM Conference on Electronic Commerce, Denver, CO, November 3-5, 1999.
98
Crawlers, auction proxies…
99
L’étude suivante propose une méthodologie pour analyser les comportements des robots sur les sites d’affaires
électroniques. Virgilio Almeida, Daniel Menasce, Rudolf Riedi, Rodrigo Fonseca, Wagner Meira Jr., Flavia Peligrinelli,
Analyzing Robot Behavior in E-Business Sites.

©Kamal AOUDA 2005 www.kamalaouda.com Page 40 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL


•  4  ? -;
# ?!  ?? &
!- ]("$!  H1
") #
) <] *+!   4#  
 5 5
v
   . ]?€F*+  Ì IœÑ(
!"? a † I Ì Iœ{I Ì  *+ 
%#”p

 a … !  

ÆÅ Ì
Ñ( $

 
Z _=.õ:)É?  
Jp$."H .) ö!  a =eç”",*4*+."?c . N IfJ‡ > .…  @ 
=.
! 5) . ;
1 /  > . . 
.
.
!
 *(
< ; ",*1> .*+?   ( Z
) $
*+ 1 
]   ;"$.Z+( . ]!  @ 
H(
",
 I Ì I Ñ(
!"? 1 † I Ì I
{I Ì  *+  L ]  
 !
 
œ*(
< ; ",*15 .*+!  5 5?  N € *1
 ;;?€1", . Z
)  (4]
   .
.(9
? ] •s
`
3 I  C]
   .
. @ 
!    !!  Ú  .ô
#
"$ #"!$ c š ,=.*(  Q
q  

.

 5B›.!>]
 "? Pì N ! # ) !ì*(  @ 
i=) 
 ,!!  ##< P?,] ! aa ì) 
"$  .”I
0I k q"  ! 5 @ 
‚g
 N !    !+ ‹  .D
\N  ?=.)*+×&‚=) 
 ?!! i > Ÿ.
.r
"$  .g . @  N   š .,]! q î
.

 5͛#!>]
 ",  @ 
/",)#  ? q9W 
.
  ? 
I
`
:",*15 .*+? ‡:"? F?€…", . Z
)  a , A.
# !! . c9T N  cN 
c 
Z.*1*+c  
  @   # #.?] a  +=. "H  
  . ;a
!N 
  .//",*4*+."?   "H .
 @  /  
`
@    / .   [
,  
  F! #c"?  =>=# #! . =. "H  
  .  I  F"$  =>=)# 
 . 
 
  -=) <
"$   &*( @ ? f  .   &",)# !! 9 F
.
   .   @  N 
4]
   . 

?!4N 
 -=. "H  
  5 49
 +! ##I
J *1*+44 !  (] 
  \?€-Z.
$
 @   + 
.
   . 
 @  N 
^]
   .
?    !  
K
=. "H  
  . ÇÅ "$ #N1 H f Z
 /9[
…3 
K  1]
   .
.;a [
#*1 <#", . Z
) / 5
`
@  N   a , K
.  @  *+! 

  …
‡   ]
   .
.# ]! … a?€
 <*+a", . Z
) I 
.   aN 
 F=. "B  
  . …9q
 …! ##c",*1!5 .
 .*1:# !=) €
 c~5 $
 
É;  *+ ƒ

.! ‚  @   ]
   .
 N  "
 a ! .."H  ] 
" N 

  ",  I 
! f"? .*1  
v
# ??
#"? G   ]  GC!>] 
… ?] ? Fd ##Ð  
 GL . .*+! N 
 š?]   
# @  d .P-N 
 4 .  1# H .
1-    I

Ñ  $ *(  @  *+! p"?q*(


< :",*15 .*+! p , A#
# !? . Ti …H_, .<*+T~ & ƒ
-
v

F  @   ¥:È>É Ê Ë ÌK H ‡  c*( #) "?cÍGF",? .!! ‡  F
.
   .  5   F! #
v
  [=. "H  
  . a  .ID
‡?q5 ‡ H Ê
 *( #) "? @ 
",!  ! Ê  / .*1
# =) €
 4*( _ ^ ]! "!$ @  + #.   I

100
Source: D. A. Menascé, V. Almeida, R. Fonseca, and M. A. Mendes, "A Methodology for Workload Characterization of
E-commerce Sites,'' Proc. First ACM Conference on Electronic Commerce, Denver, CO, November 3-5, 1999.

©Kamal AOUDA 2005 www.kamalaouda.com Page 41 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL


",
, #L C*4
#C*(_ l¡=.  @  N 
 l=. "B  
  . P!.C!    !
C/

v

]    .
q~ † Ë ƒŽ&  Ð? .
5Ð Z
Z<#?  î# ?  !  ììH_H .<*+ÚN @   š    # 
 
 ]! s

101
Figure 14: Modèle de comportement d’un visiteur relevant de la catégorie 1


`
 \=) Z
# 3  ‚3,7š #=) < .? •
1 N !*1
   - .   1
?  
  ( 
œ
4  .;
­
",*1*+#"?  
"B .
 @  /*(   
•

? 5   ? N  ] #•N 
 Z.!    .  . @  N 
] !  # ]  N  *1"H ("H*1> .*+?  i]
   . .\     h=.*( "?41 N 

  ",  I

2.2.3 Mesure du débit et des coûts y afférents (benchmark TPC-W)


k  *+  
# ; .
  
    ",*1*+… …*1
#F
…
 5
&…# @  d . / .?"B  

1!
",P l ,=>=) !! 
D
; !]   ¡ 
 4N 
 l

  ",  RS",*4*+."?
 
"H .
 @  1   \",Ï! 5 @ 
? 
B?! 
,?" 
I

101
Source: D. A. Menascé, V. Almeida, R. Fonseca, and M. A. Mendes, "A Methodology for Workload Characterization of
E-commerce Sites,'' Proc. First ACM Conference on Electronic Commerce, Denver, CO, November 3-5, 1999.

©Kamal AOUDA 2005 www.kamalaouda.com Page 42 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Figure 15: Modèle de comportement d’un visiteur relevant de la catégorie 2

Ì  N  , 5(l ¡"$.ZRg . ]  &A"? ‹*+  


# q
 ] ! (d #D",."B . ) ?
 rr .!
",*1! .W±",*1> .*(! g ô]
   .
.±.", @  W ±*(
<  UN  ! .."H   %#)6
 =>=# #? 5TZ#! ^
 q 
 5q =h=# #? 5T ( N  =>=#
"H .? +
r  ‹ h=5)*( "? ¡ 
`
*+d*+a*(
 <#
%#”EØI    !  @ 
 . .? fF"? > .",."H . ) ?  ??  Z /*( /  
*+ $

 
Z   @  N    …!    !! p …?! p
, 5
. !
 F p [  
 ! p
/ 5 Ÿ.
.
",*1! .+ ^ 
" =) " . i \

  ",  \4",*4*+#"?4  
"H #.
 @  I
k Q
 Q .! 5  ] ÐQ, 5
. !…  ? . C*+ $

 
Z  L š  G

! .F?€
‚
5  "
 ) . ‹ g

  ",  gS",*1*+#"?S  
"H .
 @  &\ ¡ðf.?"B   ."? ?  Z
v
>=.*( "? JK
 " H "!#
   "$
*()ÉA .?
"H  
 Bð JKç#õ‹I J‡ "$
*()É\#
!
v v
 

 + 
" =) ",   @ 
Í =) 
 ”s
`
 i=. "B  
  .  @  +   =h=))  N 

  ",  I

f4 5   I

 + ! .h=."?  I
• `
 ^ .*1^;# !( 5 .
  +
"$ @  -=."H  
  . I
• `
Ñ-
<    
 B
 4k‚

 (~”Ñ1Êk‚ƒ'I
• `
 +*(
<  ^1",*15 5*+! 91 
 ] #   ? .5
Z  ] 
"- 4  .I

102
Modèle d’interactions avec le site appelé aussi modèle de comportent dans le reste de ce document.
103
Par exemple sur les sites de commerce électronique la demande pour les pages générées automatiquement est plus
grande que sur les autres sites. Cela réduit les possibilités de mise en cache et par conséquent augmente la charge de
travail que le serveur doit traiter.

©Kamal AOUDA 2005 www.kamalaouda.com Page 43 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
  
" =) ",  c 
#
" !
 N #"$
 .
"H 
#…a  .
  / .
"$
 
Z   @ 

 ] ! ‡d #
c
!    !
 P
 L",, 
 #I+JÊN  , ?€P"$ #"$ 
.
&-?€P  .
.¡Q  Z "  l ?€
",, )"H . . @  N   
.  ! œ"$     1 .
"$
 
Z    ‚ N #"$
 .
"H 
# @ 
 )*+ h .!
N  > . #L L*+   
  ]  ¡L >=.)*( "?¡? i
 lD .*+ R
S 
 @  N 
.*+ \4",Ï? ”I
`
 "$.Z: . ] •:ð JKç#õw , pZ  #


?]
 .
 *+? "H! .Á qËc 
r
v
*1
  .
5R  *1
 ! 
   
.l*(
<  RP",*45 .*+! 1  
¡  .SP",*1*+#",
 
"H .
 @  IJ‡  *( ( . H .  -  *+! 5^ 
 ]! 5 s
Š^ ,  - \! ?  (*4
  
  
I

Ñ4 !1(","$ I!Š^  .  ( _
*1 @  + +
Z \95  N 
  
!++


 
I

Š^ ,  - i .!?"H   I
   
"B ; N  ! . Z) . +
  
!4+


 (~ Ì Jjhk‚ƒŽI
• `
JK
 €
 - I

fe l 5! @  Q  "$ *(É,%#ž &\ð JKç.õÀ )*+ G"H*1# Ð >=.)*( ",L / C.  
v

) €,›” h=.*( "?î šB_, .<*+ šU",*4*+#"?î  
"H .
 @  Y~#•_!, .*+Y8‡ð• , >ƒ
",*1
! :N 
q!>] 
-*("$
  &KN 
q!>] 
N 

  ",  &MN 
q!>]
A’i&KN 

Z ,  
 #q‹
!q
q


 c AN 
 q
   ",   @ 
#   
"H .‹  …" ! …‹ 
`
 
" =) ",   %#)ouI P h=.*( "?¡ H +€
 ) *+
DTõ‹j PÎÐÏ =."B .
/  k
!", 
   .^ ÑG~>õ
v
j“! .."H   
", ƒS ‚Ó  Ò›5õrj PÎÐÏ =."B .
h k
!", 
   .^ ÑI 
‡
 ",*1
##
v v v
 @ ",  , .! •"? 4?€*+ ) @    &  , f
"? ?? ##] 
 • ] 
";
 4 5  
 
 4",! .
-  4 
"! =) ",  I
`
N 

  ",  F",*1*+."?F  
"H .
 @  / .   @  / =) 
 [K F 
" =) ",  / , 
  .
/] ! .F…  ]
# 
 .  ;=. "H  
  .  
 ]! . 4s•#
"$ #"$ F… .

 5
& =h=) "$
Z
 š ?=.*(  ì#   ] Ð?€V
.

 5
&# Z , #.  &F!
 cN "$ )& =>=) "$
ZÚ 

.

 54]   h . 
&
*1 
 , .   
.

 5 IJ‡ 4=. "H  
  . ;?! ‚. 5   ; 
p3
­

Z +
! 34
Z;, 5  @  /~Jp, 5*+f Z , .  ƒŽ& 
Z
  @ 
  ?] ? d #*1 ! 4
­
","$ È~”â!’ .
 "B ”&O• , g  ×& .
 "B Dk 5  
&: #"$W  
 >?ƒl 
Z 
v ` v ­
"?"? ?  
  i]
 ; ~”Of,_1# @   H ”& 
?_(",?=) )*(  &!.  @ 
 >_&?.  
  _ƒŽI

104
L’acronyme TPC-W désigne à la fois le benchmark, la spécification et l’application.
105
Certains auteurs affirment que TCP-W sert uniquement à comparer les performances des serveurs d’application mais
la spécification indique clairement que le système testé (SUT ou Systeme Under Test) est composé d’un serveur
machine, d’un serveur d’application, d’un serveur web, d’une base de données et d’une application. Le benchmark sert
donc à tester la performance globale de tout le système et non la performance individuelle de ses différents composants.

©Kamal AOUDA 2005 www.kamalaouda.com Page 44 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
  
" =) ",  [ =) 
 A
p"$ @  q
Zq q*1
#cN  *(
Z …  " ! 
& 
‡ 5   T~ @ 

:
]) 417øO/9107
2øOƒ  ( .*1!\;# !1*- €
 *1
*G~J‚=”I, 5
  3,2 ƒ”%#)tuI

107
Tableau 10 : Pages du site TPC-W

ð! . D  ‹




 ‹S N 

  ",  R?! 4",!>]
 ‹
D
 S
!D¡


 %#)„
",, )
 .",?=.)*+ *+? *(
< #   
 !
  =) Z
#…3,÷I8‡+=."H . •!", 
   .
~.
  ¡? =."H . 4N
"$    ƒ  =) 
 ; ¡ 5   ll*(
Z

  ‹]
 5   I(j“Ê"H)#  l
`
*1
#:T  ]
# aH 5"ÉH a
c : 5
 :N  ?] ! 5 #‹j ðeÑ1I  
" =) ",  c€
 Z:9q"?
@  S ¡",. K¡"? h 5R 5
 D? +"$  K
g N !*1
 D 
 ]! U s ÔF3 & 2
2
:2 §+3,2& 2
2
:2 §
`
3,2
2& 2
2
:2 § 3& 2
2
2& 2
2
E2 § 3,2& 2
2
2& 2
2
"2 ՎI .D g . , >DP!", 
   . %#)ˆu&+ L",5   . P 
5
  \
 ]) ",*1*+;  @  4
+ ( 5
  3
3 I
`
C ]
 Z
  ¡9S . ] .¡  R =>=# #! . l
Z R¡  .S!¡=. 1! P 
l*(
<  R
",*1> .*(!  
 ]! 54s

Ä ¦³³¸ «» ¸ §Öf   *1


 : …",*15 .*+! N "$! ! …
 [ , ) 
!   # 5I
• Õ ê v
k‚M"?î*(
< Vx
2m|î ô"$.ZÚš . ] ; , …Z  #
îq ï#
"$ #"$ 
`
N  ?=.)*(  4~) .’  Z
ƒŽI  \02mÐ# , 5! 5^?! Z
 # + ^"$ 5
I

106
Si le système testé (SUT ou System Under Test) n’arrive pas à répondre aux requêtes qu’il reçoit au bout desdits
temps de réponse, la charge de travail doit être réduite jusqu'à ce qu’il y arrive.
107
Source: Mehdi Khouja, Farouk Kamoun, Experimenting With the TPC-W E-commerce Benchmark.
108
Selon la spécification l’utilisation d’une base de données relationnelle n’est pas obligatoire.
109
La spécification distingue entre deux types de scalabilité. La première qui est fixe affecte la taille du magasin virtuel
(augmentation du nombre de livres dans la table ITEM). La deuxième qui est variable résulte de l’augmentation du
nombre d’émulateurs (augmentation du nombre d’enregistrements dans les autres tables).

©Kamal AOUDA 2005 www.kamalaouda.com Page 45 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Tableau 11: Conditions de scalabilité de TPC-W

1
Ö    *1
 Q L",*15 .*+!  g]
   .
. @ 
\!    !! / G  .Q

• Browsing mix
N  ?=.)*+(  1  ‹
.
  5r @ 
f=) 
 ?!! -?,]! 41 ¡) ‹"$  .”I^k‚T"?
`
*(
< ;ù
7mQ  "$.Z
14 . ] , , Z  #
• #
"$ #"$ 1N  ?=.)*-  
I  
7mÐ# , 5? 5^?! Z  # +  \"$ 5
I
.¤ ¥©¤)¸ «» ª1¸ §Ö!
!-"?;*(
<   ;"$.Z4Z  #   #
"$ #"$ 4N  ?=.*(  - H
• Ö
Z
 49;"?  4Z  #
;  \
"$ 5 I
`
 
#"?! 5
ZF "?",< ",  ! ;] ."$"  F 
Z /  .a H 

 …‡ 
…
5
  3H0I
J *1*+… [*(? #… /=) Z
#q3,‘& ["$.Z/ .]  , Z  #
>  =) "   *+! K‚ 
K
*1
  .
5 @ 
  *1 .! œ  1Î",*15 .*+? 54
"!) 51" ç) ? !
IJp$ @   *4
  .
œ 5
 

 l",
 €
 l    
! .¡ ] 
"R ¡H_, .<*+R . , . R]
 G  D
. 5",  D$! > l~#", "$ 
`
N 

  ",  ƒ4 iðœJ ›ñj ~#", "$ ‹r . > \ \", "$ lj“! .)  >ƒŽI  :"H  ]
 .  
v v
*1
  .
5?! K ! ..*1
  ! #F?€a# @  d . ",!
"!  ]  
‚  *1
 ‡  .*1
T# =) €
 :~5 $
 
É  *+ ƒŽIJ‡ c ! .)
!  F!…=.! Ê! 
 : H ) 
!  …€
 !    
 Z
  ] %”%#ØI

×%ØÙ9Ú ÛEÜ9Ý Þàßá


Ýâ"ã"ä^åÛvÛ^æ1çéè1ݺâëêIÚ ì"ê:ä æ1í ݺâëê%îIîhêIÝä;â"ÛIêIÛ:äïéÚð í Û:ä;â"ÝGñêIÚ Ú â+ò¨ó1ôõ ò
áÆâ"ã1äIåÛöIì"Ú êIí÷%æ"çHîhÝ~í ãrâÛ:ä ݺâÓøHâ^ä"ùúãâI÷%æ1ÛöIâ"ãHè^æ1Ý=Ûâ"ãZí Û÷-Ú;åãâ"ãû

110
Source: Transaction Processing Performance Council (TPC), TPC-W BENCHMARK, Version 1.7, Oct 11, 2001

©Kamal AOUDA 2005 www.kamalaouda.com Page 46 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

111
Figure 16: Modèle relationnel de données de TPC-W

ü ýfþ%± «´³ ¾"ÿ «A¸n¸ ¹ ¾ ­MÁ ­ ¹ ­+­¹"Á ¬x­ ÿ¾ À d¹ À «A¸P¬x­ ÿ 
  ÿ «A¸ ¨³¨Á ¹ ­ ¾ Á ¨­ ¾ ¨À «A¸P«¨¿ ¿ À ÿ À ­xÁ Á ­¬x­MÁ  ÿ À ¿ À ÿ ¹ À «A¸

µ%± ª>Á  ¨¬ ¾ ­ ­ ¹ ¹     ¹  ÿ  « ¾ ·  ¹  ÿ   ­ ÿ  ¹  ÿ  ! #
¯ "  $ ¬¨¿
`
 # @  d .  ?] _
    *1
  .
.;  ./?! ‚. > 5"$
 ;9 ;! ?  ;
!
`
 T
#
T ,  Z
 *+? p .*1 
q! T
 q , ) 
!  €
 !    ‹ Z
  ] I  
! ?  ;",*4*+ "?? •
  Z
 5 #*+! •9F a
ZN "?"   Ief   1?! œ! >*+
 1!  0
!"? ) 
4s
"? ) R3+s  …  # @  d . …
. ]
 
 ! KN 
:!    ? .
 @ 
• q
?!< q!
F

",*1! .;~."? (# @  d . ^
 ?! Z  #
 \02mC\ .*4?ƒŽI
"? ) r0/sÊ  q# @  d . q
. ]
 
 ! N 
r!    ! .
 @ 
f ,  ͟.9‹
# Z , # I

k‚;"?/",

 ! $ ?  =) ",   , f# @ 
 !F~#"? # @  d . 1,! •Z  #
 ;x
2m
- .*1?ƒ'I
` `
;
#
 *( _ 
 11"$! @  1! ?  4 , F3,7 *1 
! .  I . @  ;"? > .+
#
1N
",
 &
`
 N *1
  .

=#*+   \",
 €
 ^ðœJ ›ñj   

 +# Z  <#;
 ;?]   4! ?  I
v v
`
T 
 i , i", "
 T9R5  ir*1
#TN  ! ..
"H  !%”%.6 # ?    @ 
œ! \  q"$ @  
!
",a! ##…   *1
  .
.U K aK8ðr~#•_, 5*ô8‡fð• H 5ƒ'Iœ8‡ … ! 5."H  F# ?  

 
  Z
 5 #*+? #  
"H .  +  *1 . ^( .*1!\ =) 
  \
( ( 5
  3,2I

111
Source: Transaction Processing Performance Council (TPC), TPC BENCHMARKTM W, Version 1.7, Oct 11, 2001
112
Requêtes et réponses.

©Kamal AOUDA 2005 www.kamalaouda.com Page 47 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

J *1*+ N €
 Z   
" =) ",    ; 
 
 d ## "H."H . ) ! ( .! ",*4! .;;*(
< 
K
1",*15 .*+?  ]
   .
. I Ì   s
õ‹j [   Z ; 4 
 !
 ;*(
< 44",*1> .*+?  $

 Z *1 €I
• v
õ‹j f;?"  
B4*(
< (.) Z *1 €I
• v
õ‹j +?"  
B4*(
< 1
.’  Z*1 €I
• v

113
Tableau 12: Pourcentage des accès à chacune des pages de TPC-W

114
Figure 17: Environnement TPC-W

NB : Le PGE génère les mêmes requêtes qu’un système de paiement en ligne utilisant SSL version 3 ou TLS
(RFC2246). Les RBE génèrent le reste des requêtes.

113
Source: Transaction Processing Performance Council (TPC), TPC-W BENCHMARK, Version 1.7, Oct 11, 2001
114
Source: Idem

©Kamal AOUDA 2005 www.kamalaouda.com Page 48 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

#"? @  N / F ? œ",*1# @  /"? @ 


  , •"H*1.
 F / 
" =) ",  €
 Z @  F  
v
* #) @   - 

*+ #  -" ç ? \? ! ",


 \\=."H . 4!", 
   . (=) €  @ 
H",*1*+
+
`
 N  ]a]
T#=) < .r q 5   qT*(
Z

  …]
 5 #  %”%.ouI  *+  ) @   …]
 
 ! A
 "
õ‹j PÎÐÏ =."H .   k
?", 
   .^ Ñ&Rõrj fÎÐÏ =.
"H .
  k
!", 
   . ^Ñ&¡ Põrj 1ÎÐÏ =."B .

v v v
k
!", 
   .^ ÑI
`
. @  N Z*+? .c …*1
#FN *1
  . .F
Z  #Ê
 ["$5ZaF #. ]  
 
" =) ",  +€
 Z @  ; *+  ) @  -õ‹j ] ) =) ; N   Z
  . 4 
 ]! .s
v

~”â‚*1
#4 *1
  .
.,ƒ.›Ž3 Ï4õrj ÆÏ~”â‚*1 #1 *1
  .
.,ƒ.›‘
­ v

] ) =) œ"? h .  Z
  .  ,=.! f#   
"H .  1",  4!", 
   .  =) 
  4
  
v
5
  3
3 I
`
l 
" =) ",  R =) 
 ;
 ¡! #P*+  ) @  P 1", "
   P.
5 ; ) €,›” h=.*( "?
`
~)
) €,›>õ‹j fƒ'I   ) €+ @   ,  +",*1
#s
v
`
c
) €  =h=# #? . /"H*1
?! . F*( . )     ‡ 
Z "    FK8ðg~ Ì  .

@     
) €- - *1
  . .+ N  H 
(  " ?ƒŽI
`
[
) €, 5"!ÉB
Z ;


 F  Z [~J‡ a",*1
#… [ ) €, 5
"ÉB
Z

 +


 4",!>]
 +
; 
!/ 
   / 4"? 
? +


 +Z  #
 
‚  ; *1
  .
.1  ‚
 F ) 
c3,x
2-Ÿ.
.;9a. ? /xF$ 
# 
Ÿ.
”I
`
P" !S‘I 0I ÎI.3rP S 
" =) ",  ¡€
 ZG4   
.g9P"? @  N  K_D 
 
 ) 
4( . .*+? 5+   ! .).*1
^N 1*( 13 Ÿ.
.?ƒ'I
­
`
;",Ï! 4 54  4 
Z "  - _! !>]
H9 
.
 "H  &9 N 
*1 
 , .  + 9 

*( ! . "?+  N 

  ",  1~”jhkÊe‚&Hõ[އ‡j õ[Þʊ;݃ŽI
J   ”& 
) €4 5 5! , ", "
  
 . +
&   1 47;$
   
&
.
 *+!
‡
 . ?– .BŸ#

 !!*+! ô.
 z ˜?>] 
.˜ ",*4*+#"?z  
"H .
 @  
",*1.  ] *+? ,€(? # ^!h] 
. I
k  [Z. [",*1
Z
  …",*4*+‹jhOfÑ;&K8ÊâGTÑ4 ". ? => i?    !! p Ÿ.
.N $

ð JKç.õ

v

 . H .Ê  >=.*("?[: 
.a .

 5!%”%.t^ f]! .p  .a*( ) . FÊ.
> 9 
", "
)#"?I

115
Nombre de livres stockées dans la table ITEM choisi obligatoirement dans l’intervalle { 1,000; 10,000; 100,000;
1,000,000; 10,000,000}
116
Serveur d’application, base de données, serveur http…

©Kamal AOUDA 2005 www.kamalaouda.com Page 49 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

J r  "$


*()É[ 
^ *+ )&   &  
!pN 
:"$*1:",*4*1
cT 5   Z7Â"?
‡
?€ @   +  -"  ! 5!%”%#‚ ?]! # ]   =.#"? \   i=. 
  ?! ^  
.(
5

 5
I

k [",Á . … F @ 
   [ ]  
 *+! p   "!$
*()É ð Jç#õ± ! K?>]  ‡[ .*1
  5
‡
v

g W*1 !ïï "?UN 
î?]
 .
 *+! qî . , ‹ )*+ > 5? ‹ W*+  
#ï ‹ 
",."H . ) ?  / 
 f 

  ",  a",*4*+#"?a  
"H #.
 @  I Ì  N  a !   
g . , 5T? 5*(  !  &i N "H  ]
 . RZ  #
l1  r *1
  .
.g ? (d ##g

! .
R9D 


  ",   @ 
",*15 5!  (=. "H  
  .     *1
#! 1 f
 1",*1
 €  
Ik

 M  M*(
<  Cš"?*1> .*+? [ c  Q",  Cì!", 
   . š =) 
 M: 
 
" =) ",  Y ?] ! q!N  ] #rN 
 ïZ.Y!    . W . @  N î?
$ 5Y ]  R  
!"? ) 
\ 
 ]? 54s

õ‹j fs*+ h #a   ", [


# ,   
K … ?


 Z  .! 

• v
*1
# *15 5? K# @  d . [

 .c p !> ”IÑ(  
#A [ .*1!. !
`
 


 *+! 5 #SZ. G  R",
 €
 R I(8    !*(
?  ] *+!   
.?"B  : 5! \g
# !>]! ( N  ! . Z) . ‹D ¡
!‹‹


 r~)
.
) . 
Ì Jjhk‚ƒŽI
õ‹j ¡ õ‹j ;s•"?", 
‡9q q
!……


 Fc 
"H 
#…!
 ~# 
 ç)
 _ƒŽI
• v v
Ñ4 !1(","$ 4 \


 -  ( *(
Z  I

J *1*+g (-   


.
&A R 
" =) ",  R g !=) 
 +
‡ N #"$
 .
"H 
.g¡ N 

  ",  r
K
",*1*+#"?1  
"B .
 @  ;
?  ^ .
"$
 
Z   @ 
B  ] ! d ## ?    !
 +
 ;",, )
 #
%”%.„uI
J‡ TZ
.!  q?g5 5
   . T ^  ?!q?€! #
) !  T"$ €:g N  *1
 *+! .9g 

",?]  "?I 
  @  c"? ‡ ?? #. .…a",
[>  "
  ‡ 

  ",  /c",*4*+#"?
v
 
"H .
 @  q
") . …[b! ]‹[ ]…=h=#
"B #  :#
"$ #"$  :
i#  5 5) ^  
`
 =>=# #? . R *1
 *+! 5  Tb! ]¡gð JKç#õrI  R#  
 5 5TS
g# "$ #"$  T?!
v
",*1
  \
( + 5
  3
3 I

J *1*+š 5? …! ##î "$


*()É ð JKç.õ½V š  *1 .  @ 
1
 ] ! cd #î
) ! M
K
v
",   .  (4*(*+? ; *+  
#+( 
   \",Ï? 5i_- =h=# #? 54s

117
Les résultats des tests effectués par les compagnies qui sponsorisent le benchmark sont publiés à l’adresse :
http://www.tpc.org/tpcw/results/tpcw_price_perf_results.asp . Les résultats des autres compagnies sont publiés sur leurs
sites et/ou dans les réseaux de presse spécialisée.

118
Les pseudo-codes inclus dans les annexes de la spécification ne sont donnés qu’à titre d’exemple.

©Kamal AOUDA 2005 www.kamalaouda.com Page 50 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 1
 *1
  . .+Z  <#? œ
 "B  ]
 . @ 
 #=) < ./ 
 @  *+! f  4",*15 .*+! 5+ 

]
   .
.-
4
;*(
< 4N  =>=. #O0J‹~)  4*(
<  +JK0JT •O0O… 1?! 
4
) (
",*1! . ƒŽI
ð K J ç#õ   *1
 l

 @  *+! - r",*1> .*+? 5‹$

*( 
I\j“=. -, .
"H  ‹l 
• v
"$.Zg‹ . ] ‚Z  #
¡4  ‹. 5%”%.ˆ @ 
‚! +
R*(
< gR",*15 .*+!
 
" =) @  I
`
P  "$
*()ɋ P
# ]! + "
 P ! .."H  l
1 ]     D >=.)*- "? ‹ 

!>]
 "? M’i @ 
N  *4
!! q±
 VU
 Ú
î ±*(Uô",*4*+#"?
 
"H .
 @  I
`
 ; . H 5 ?? ‚*+  
/
/?]
 .
 *+! f",! .Á @ 
 a#=) < .a
4=.#"? *+!

  -",! #. ! . \4",
 !€
 ( 
 -’iI

Tableau 13: Implémentations Java du benchmark TPC-W

Eléments de Serveur http/ Bases de Eléments


Implémentation
l’application Conteneur données manquants
IBM WebSphere
Pharm , , Apache/JServ,
Servlet et
http://www.ece.wisc.edu/~ph Sun Java Web IBM DB2 PGE, SSL
JDBC
arm/tpcw.shtml Server, et Jigsaw
Web Servers
Amit Manjhi
http://www- Servlet et
Tomcat MySQL PGE, SSL
2.cs.cmu.edu/~manjhi/tpcw. JDBC
html
Christian Plattner Servlet et
Tomcat Postgresql PGE, SSL
JDBC
Mehdi Khouja, Farouk
Kamoun, Catalina M.
Apache
Llad_o, Ramon Puigjaner JSP, Servlet Oracle
Tomcat -
et JDBC
cllado@uib.es, puxi@uib.es

Parallel and Distributed


Systems Research Group
(PDSG)
Servlet, EJB
JBoss MySQL -
et JDBC
http://www.cs.nyu.edu/~toto
k/professional/software/tpcw
/tpcw.html

119
Crawlers, shopping agents…

©Kamal AOUDA 2005 www.kamalaouda.com Page 51 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

3. Gestion de la performance dans la phase d’analyse



!  
$
!4N  _!   \ _, . \N  =>=. . %.6׏œ!  .
 "?49 ) ! 5? .  

v
 > .?  Ú 
r  ì 
" = ",  Ð=. "H  
    MÚ ) *+? : ì 
"! =) ",  V
`
=. "H  
    …",*4*+r  :  "$
*(ÉB… i  c*( ) @   [r h=.*( "?I 
.…!=>=.5 5
?! f", "?? # 

 @  *+! • 
 F",*1
# $ !  
*(  /N  =h=. #  & N  _!/ 
%   ? *+    & ‚ =.*1
     ",
;N !    ?   @ 
 
",
 ! ”I #"? @  a 
v
 >=.)*( "?[ H ‡ …",! @   "?a #
"H .a ? !  F# .
  [
 ]   F
$
! 
T   Zq T",


Z&Ê  :",  <#? @  q?TZ ,   %.6Ž%\]
. id #‹ N 
ZT 
#"$
 .
"B . / ‚ F .
Z5*1*+ .
I•J‡ :  /",
 ‡
 ??] ! ‚9: c
 
" =) Ê  
  "$
*(ÉB— M  Ó*( ) @   nw >=.*("?˜
Ó  —",$
 .Œ —"$.Z  I
`
N €
 )  "?ac
   
#F
.BŸ# 5a ]  
 *+! ‡*(? # @  ["? h .a *(#"$ [ H ‚9
 N ) Z  4 +  ",! @   "? \ 
 ]! . 4s
`
  >=.*( "?; -=. 
(5  + (
)  " ?€+") .<# ^N ]   -;  @   . +

 N 

  ",  I\ef  ¡ , 1# Z
D9P
¡.ZP ?=# ) 
;  g)) <#S  r 
" =) ",  
=. "H  
    
I
`
M",Ï! / C# ?? #"? Q$

*(    &+ .
"$
 
Z @   L =)  " <# P  
 G9Ú 

Z ,  ( + >=.)*("? - ,
=. 
   
!  
$
!44   Z+ 1",


Z *( + 
".  *+   # *+?  !
!   +
$ ! ^ 
! @ ! . -",*4*+  ;*(? #; +=) Z
#/3 I
Ñ- Z# ? *15 5 "?& … >=.)*( "?a =. !
/>   1 .*+ ;",! . @  

    *(, ) !+N ©?]
#+9  *(, ) !+N ?]
.
ZI
`
 + @ 
   (4 . H  
*( ! . "?1]
 
 !  4 ",+ *1 ?? #  @ 
,
 ] !



?!• Ï *+!   4 Z  Z  "? - -#"$
 .
"B . (  +
.
Z.*4*+ .-  .?] 
9 $ .4 \? ?  +!     ]  +
  ]
# N 

  ",  (
+  \   
I
“j F# ??> qï"? î  ",! @   "?  @  X¨ © ²î´ © ²?¦¸ «²ô©«ï³ ©¤>¶.¦¤ª(£« ·?©U¥
¦¸ Æ ©«!¬‹à ¬¤#©
·,¦«² ¸ ¥Â¤# ²D·,¦ª1ª+©l¥© ²¡´ © ²?¦¸ «²R¥à £ ¶>¶.£¸ ¤#© ²R© ¬«¦«P·,¦ª1ª+©l¥© ²l¤# »¨ £
»© ²R¥©S¥©¤)«
¸ µ¤#©
`
ª1¸ «
¹!¬.© 湸« à £³
³£¤.£¸ ²²!©«!¬³£
²(² ¹
¤¨ £/¨ ¸ ²,¬.©1¥© ²1³
¤)¸ ¦¤)¸ ¬. ²
I  œ ! . Z.  4 
."? ? -
 ]  
 *+! *(

 ",! ) 
!  ;"H  ]  f#  ?
  5   4"H .
. @ 

5  "  ! …
.BŸ# Ê~*(
Z.
& _H . 
&#"$
 5
"H . 
&f .
Z.*4*+
. & *1 
 , . .
.
y
! ™ 




&C
*1 
 , . .
Vw!>] 
ì’i,›#

  ",  &Q @ 
   
*( ! . "?•Ýƒ

120
Ces affirmations sont basées sur des constats personnels dans plusieurs grands projets de développement.
121
Gestion des performances

©Kamal AOUDA 2005 www.kamalaouda.com Page 52 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

k +"? > .5  &!4


.
?1
 ; *(#"$
œ N  ! . Z.  4 *-
Z*+!  
‚
 >=.)*( "? -9 
$
!;N  _!I J‡ > .1 *(#"!$ ; , "?! #
1 
• *( < 1N  =>=. # 
 @  ‚# <]   N 

  ",  r",*1*+#"?r  
"B 5
 @  Ip8‡ =. *1 !rw©?]
#&K  
 )*+ > #.1?€(#"$
 . "H . - ?€1
.
Z.*4*+
.\
4  
!N 
+!*1
  
 -",*1
 
N 5 .=."B 5 @ 
 
" =) ! -  r  ? q‹ h=.*( "?‹‹*+d*+T  ## @  D  r  ? !
=. "H  
  
I

3.1 Besoins en performance et modèles d’affaires

3.1.1 Besoins en performance des sites B2C


Ì  N  ! . ) 
f*(
< /N  =>=. # /O0J&4=#.;
#  ]! ‚  ,   "H  ! #/?€
h_
  \+  . +s
`
 \  . ^N  ! .*+    \=)  " <#I
• `
 /  . /",?] !  
  [ $

 Z~ @ 
 ] ! F  5  a
.

 5͛‡!>]
 "? 

\=)  " .,ƒŽI
`
 /  . /N  ! .*+    /=)  " <#[?! f]
   . 9
…>_! $ *+F #< a ? .  =”I 
! Ê  
v
$. # …N ?] 5  #q :*(#"$   …"  ! 5…N _:",
 
"H .? ‡=)# @  *4*+! ^  
 ]
#
 N ] !  1 4",
.
&
=>=.
"H   ( #.?"B  
& ! .
  ;?]    +!
"H 5)    4 “›#
`
. 
"$.Z/ L.
5 >SN "H  ]
 . I Q",."B .<.G]    C S


 S   @  M 
 
>]     "?  .Z

 *+  a# Z *+! 5  €
 Z! fF"?    . /
 ##<  Z./ 5?€
4  
 
   . L  i .*1\;# !! $.\-",*1*1
4~J=×I?!
"B  (0I.3I53 I 0
ƒ'I
`
 a",
ŒN !    ?  [
F  . FN  ! .)*+    F=  " <#q
!! ‡[] ) 5
  F =) F9
 N @ 
  44 ]  
 *+! #"? @  s
j“ \Z*+! .?  1*(! 
  +
Z ^Z  .
 \ _
*1 @  *+! )I

j“ +*( h .!    ",
(1
# ?  (    !4(


 
I

j“ a=.? ^*( ?  ] *+? A  •?€:!>]
 "? …N 

  ",  [  #", ~#€ *1
 s‚!>]
 "? 

’iSN 
(H_!, .<*+44",*1 ?  4 , 5  4 
  *( ^=).*++N 
-  5?ƒ'I
`
 C
Z P P  . PN  ! .)*+    P=)  " <.Ð",!  
 ! a LCZ.
$
  *+ !%.6”6uI
J‡5 5 4?! , 5  @    ~) 
Z
& *(
ZZ =  F ]
 Z
  ƒK*(   F
 
> ?! Z  # 
9: F]
a 
Ê :
!F
 


 F 5?
  !
 ["$ @  c?    ? .
Ê~#"? @ 
  *1 .
  +
?  
   . \;*1 !1+","$  ƒ'I

122
Ces affirmations sont basées sur les résultats des travaux de Stacy Joines, Ruth Willenborg, Ken Hygh publiés dans le
livre Performance Analysis for Java™ Web Sites, Addison Wesley, September 10, 2002, ISBN: 0-201-84454-0

©Kamal AOUDA 2005 www.kamalaouda.com Page 53 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

123
Figure 18: Pattern du trafic quotidien sur un site d’intermédiation financière

`
 ;",
.1 4  #  & ‚ 
‚5 )&
 ] ! œd #5 =).H×"$
 ;; .*1#
! =)  F#=) .
 a _
*1 @  F[ N  =>=)# [ a*(  ‡  *(#"$  IJ‡[. =.,”"$
 ?!*+!  

 !
Ú!
 *+! T Y
!ôô


 V*( š Z
 *+! T  ì

  ",  M  #"?  @ 

`
=.
)
 ?!?  
.;!>]
 "?    .I  

     N  ?=.)*(      .
!5 5;N "H  ]
 . 
 =>=#! )&• 
*( 
&•
  …
?  
   . …*1 !a","$ …#"? @  … 
.


  
?! ‡
F.
 *+! ‡  ??
  F~.  
*1*+? ‚c : ) 
 " . a a
    / ‚ 
.
> 5-"?   ?ç”", 1"$Z! 
^?  =)# @  *4*+! @     \",
.^ i  # ,ƒŽI
`
 4  ? (+!
"
) . 1 =>=#
"B .!  Z
 *+?   4 >=.)*( "? - -  . -N  ! .)*+    
=)  " <#IAè(! ##S N 
  Z  ¡ Z
 DDZ
.+ T ."? r 
- 5! . R  T .?
"H  !
=>=#
"B 
 Ç"??€!ç”"T
"$!Z! P È


 È",?=) !     %.6)žM]
 — Ô
. 5",  
`
!
"
) ! P~# &+Keð‡Ýƒ'I4JK*4*+Ð Q*(? #Ð  D=) Z
# Q3,ùC 02Ð Q.
",
.l9C"? 

. 5",   Z*+? .… / .*1 [# !F . !  K F 
 K 5*4*+! F. ?/ 
 ">_
! 5
Z rR


 ‹ - q] ) =) ",   @ 
K
 ] ! +d #¡!=h=#
"H   r

#< T 
.Z

  *+ -;"?5  =) ",  ;~#€ *1
 s?] ) =) ",  ( -


 -N 
1"?5  =) ", 

*+ ) @  


#< \ † )   Z %.6”oñƒ‚I


 
5 )&   \  . \
4 $

 Z
# !! .?   +*+d*+ -",."B . ) H  @    @     \  . 
v
 N  ! .)*+    ^=)  " <.49 1 =h=# #"?  #<  @ s
`

.ï
Z ï# 5 ) ? R
±*1
#X
 ï *1!5 5? rN  *(
Z ï~.?š=.)*+Y

", 5 
Z  \ ] 
"- 
,  
   . 4N 
Z. (;# 
 #  4 5    =h=# (ö!
*-ƒŽI
`
 ;


  @ 
 !>] ! •9[ Z  .    ", > 
Z  ;?! *( 4]      "? @ 


 =>=# 
 \;
?  
   . ^ *1 !4+","$ I

123
Source: Stacy Joines, Ruth Willenborg, Ken Hygh, Performance Analysis for Java™ Web Sites, Addison Wesley,
September 10, 2002, ISBN: 0-201-84454-0, pages 464
124
Numéro de carte de crédit. Numéro de compte. Identité des clients….
125
Clé publique, date d’expiration…

©Kamal AOUDA 2005 www.kamalaouda.com Page 54 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 .=) " & @ 
, , 
 4
# !]
   
 & > . ! ?;. €,_ *+ 
?   4 ) 
 -+=#d . 
4

 ;  @ 
 
  +~>] 
=) Z
#P0•3Hƒ'I
`
N "H  ]
 . 4 (. 5\
"? \  . \ H    ",
4  + ! .  ] I

Figure 19: Impact de l’utilisation du protocole TLS sur le débit d’une application d’e-commerce126

Figure 20: Variation du temps de réponse et du débit en fonction de la taille de la clé TLS127


‚…
 *1
     ?=5)*(   
‡  ",."B 5 ) ,  @      . O0Jl K 
‡ *1"B
v
 
  ( h=.*( "? ]   1! "H  (0I 0I ÎI

126
Source: Daniel A. Menascé, Virgilio A. F. Almeida, Scaling for E-Business: Technologies, Models, Performance, and
Capacity Planning, Prentice Hall, 2000, ISBN 0-13-086328-9, pages 357
127
Source: Idem

©Kamal AOUDA 2005 www.kamalaouda.com Page 55 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

128
Figure 21: Pattern de trafic annuel sur un site de shopping

3.1.2 Besoins en performance des sites B2B

JK*1.  ] *+? ?€-  5 \N  ! .*+    ^=)  " <#&   ^  . +O0O…s
J !  
 ! *( \4Z5
$
  *+ -  


  " . ;~) 
.-", 5 
Z  \?! *- +) "$  
K

1 *(
Z  @  1"?,€( i  . \N  ! .*+    ^=) ! " <# ƒŽI
è(! *( ^(]
   . . I

ðf. .! ‡
…*1
#c*( a *1> 5! ‚F .?"B # %.6”ˆ-~5 #.?"B  /[Z5
a*( 

=)# @  ? .  @  R  … .!?"H  :r  5 =>=#
"B #
 : 
(  :  . :N  ! .)*+    
=)  " <# ƒ'I
`
e•"$Z! ;*(
?!11Z.
^=) "$
 .\=.*( . (Z  AÑ ~#   1 •
 "?1
 ( " 


. 5",  ^ 
"   ! +!    ! +
 N ekpj %#E”×ƒŽI
f! ]
   . 4 4?    ? .
. @ 
H?  ++ . !" . +=."?19   . "?~h]! !
"H  

0I.3 I.3\

 \+ 5  \9;"?+  Ÿ# >ƒŽI
Ñ d*+S A"? R  . R! 
D . =) "g .
 @  &( 
.D",
RN !    ?  ¡
"  "$ ! 1 
(
. .*+! >z
 –",*1  €  – î
 ™Z

*(
– # ?? #"?  @  y  ™  . 
`
N  ! .)*+    F=)  " <#%#E'%'I Ì "?c  Ÿ# ”&‚ N
"$Z
: A q.  Z:cZ.
=) "$
 . AÑ
  *1 .! œ  ;
?  
   . +/*1 !;","$  œ# 
 !! œ  @ !  . /*+ *- #   
 
 

 N 

  ",  I:â‚ 5f   
. @  a [
 
5 œ"? ;  . ?    !! œ ;!>]  .
:*+ ??
Z 
H_
 "$ . %#E)6 @ 

 "?! Ê  /


 /
a
 =)  [N  > .! .[ ]! ‚
  \   ]
#- H   5 .(=) ?~#!€ *1
 s
jhOr
Ñ ! Aõ 
$ # Ñ-Ò\)  ?ƒ'I

128
Source: Stacy Joines, Ruth Willenborg, Ken Hygh, Performance Analysis for Java™ Web Sites, Addison Wesley,
September 10, 2002, ISBN: 0-201-84454-0, pages 464
129
Transaction au sens économique, c’est à dire l’achat et la vente des biens et/ou services
130
EDI FACT ou X.12
131
Parsing de gros fihciers XML, connexion avec des applications tierces via des middletiers, traitements batch…
132
Comme IBM's WebSphere MQSeries

©Kamal AOUDA 2005 www.kamalaouda.com Page 56 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

3.1.3 Besoins en performance des sites C2C (online auctions)


`
     . a] ? .…?€a "$ <# 5  "
  K9q5  "
  ‡! K F",
/N !    ?  [
 /*(
<   F",*1> .*+? @ 
  =>=#
"H .? f =>=. #*4*+!   /  ? F >=.*( "?I
`
 \ 
" =) " . ^4"? ^  . \!;#  
*+? ",*4*++ 
 •s

8‡ 
 (Z.; =>=)   "?#"? @  N   (?! =)# @  ! . (? 
  
("$  .
.

@    i]
. I
`
[", 5 
Z [",!  ! ‡ [
 Z.:*1
#aN 5  "  F~#"? @ 
  *1 .c  F
?  
   . 

 *1 !4+","$  ƒ
`
 /
.

 5;
 ] ! =. .[ N  Ÿ# f[
   
."$ <#   ]? fN d ##"$ . /~."? @ 


Z*+! .4",   .
 *+!   *1
#+;# @ d . i . .
 ?ƒ'I
8‡ a!    ?  "?") / ;
Z! 5~)
 
 Z[
. €
  ?ƒŽI8‡  a*+

%#E”EAKk‚
 

Ì IiÑ(
!"? R † 
 !] Ì É?
 &*(! #g9D"?g  Ÿ# @  R7
7mÔ T " $ <# q?!

 "?
  …
Z! 5[
! ^ N "H  ]
 . T , ^
  ! .  ]  @  T"?  q q!    ? .
.
$

*( 
I
`
 …


 #   ]  …?€T
.

 5 q?! ^
…",!>]
 …?  Z 5*1 @  


+  \  . \4 $

 Z#"? @  1"$ @  (] ! .4
 4
 .4(]   . 4( 91
  @    c  / "$ <# F a?! ‡
 "?"?? .
  I•JK …! .,' …
   
.*4 ! 9;Ÿ.

 
 + 5
 4 (
.

 5
I
`
N "H  ]
 . N  ! .  =)  @ a a ) 
;]   . F ] ! .?€"$ <# 4 5 "$ 9

? =) I8‡ ? # 
%#Ežp*+
qk‚
  Ì IÑ-
!"? *-! ##&
 !=>=# ”& @  Î
2m
 4 "$ <# +?! =. . (9 ;=) 1 "B_ "  1]
 "$ @  1] ! ./~>=)  @ 
 #
# !? .
7mC; 1
#
+-]   . 4  +] ? . ƒ'I

`
 …
   ? a: h=.*- "?c aÎ:", . Z
)  F
c  .  @  q ]F 
 F??
#  
*+ ^
( + 5
  3 I
­

133
Daniel A. Menascé, Vasudeva Akula, Towards Workload Characterization of Auction Sites, In Proc. Sixth IEEE
Workshop on Workload Characterization (WWC-6), Austin, TX, Oct. 27, 2003.
134
Daniel A. Menascé, Vasudeva Akula, Improving the Performance of Online Auction Sites through Closing Time
Rescheduling, September 27 - 30, 2004

©Kamal AOUDA 2005 www.kamalaouda.com Page 57 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Tableau 14: Besoins en performance en fonction du modèle d’affaires

Modèle Nombre de Patterns du trafic Volatilité des Possibilités de Images et


d’affaires requêtes données mise en cache graphiques
Elevée pour les
Atteint son sommet en
cours des titres. Limitée sauf
début de matinée et en fin
B2C Faible pour les pour les bulletins
d’après midi. Ce pattern Peu
intermédiation Très élevé bulletins d’informations et
reste toutefois très nombreux
financière d’informations et les rapports
sensible aux aléas
les rapports d’activités
conjoncturels.
d’activité.
Plus de
Les données qui
possibilités de
Atteint son apogée servent à la
mise en cache Très
B2C Shopping Très élevé pendant les périodes de génération des
en raison de la nombreux
fêtes et de liquidations catalogues sont
faible volatilité
peu volatiles
des données
Peu élevé
Sporadiques (transactions
mais
de gros reparties sur des Peu
B2B échange de Peu volatiles Idem
intervalles de temps nombreux
gros fichiers
distants)
XML
Augmente démesurément Très volatile parce
lorsque la période de chaque vente a Très
C2C Très élevé Limitée
validité de la vente aux une période courte nombreux
enchères touche à sa fin de validité

3.2 Spécification des besoins en performance dans le cahier des charges


de l’application
`
Ì ] ! p02
23 &  :
.=# ?  
  [r N  ?=.)*(  @  r#
."$ ? p9g8‡Ñ T r
[ ] 
N 5 .=."B 5q
i 
" =) -  q  ? :r >=.*( "?Tr*+d*+q  ## @  g  q  ? 
=. "H  
  
I Ì =) gD",*1
 4"? > .l "
 S
  
.rZ.
  T! 4
) g N  
    ] DN 
"#
*( / 
.=h=.> 5;! •] 9… N
"$ 
"#", @  [  /#  
 5 5 ! .
/*( @  !
` `
C, 5
. ?  I efl]  
! F M
. =) +8ÊÑ ð ~”8ÊÑ . =)  G=./"$  
 
   h_&
v v
>=.*( "?&f:ðf *+ ƒ\ N è( Ÿ#
"H iÑ-
Z*+? pŠ-.
…
> . …02 23[
 :? !  
v
",*1
 < .4 , 5
. !  
 1 
" =) ",  ( +  ? -4 h=.*( ",I

k F"? > .[!


"H  c/

 . F!€ *1
  F", "# 5[ A*(? #Ê",*4*+? ‡"?
‚

. =) • ! Êd #q?    ! q
Ê 
" =)   …  ? a: >=.*( "?c
…  a",$
 .F 
"$.Z a a

  ",  a",*1*+."?  
"H .  @  I Ì 
#  
 & [€

  @  .
`
.
 *+! T @ "H  , .! g  U . =)  ï8‡Ñ  @  , g 
T
5 T
î 
 
"   ?  (   5 # I

©Kamal AOUDA 2005 www.kamalaouda.com Page 58 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

3.2.1 L’essentiel sur les profils UML


`
JK*1*+  Z

Z  # & q 5  :8ÊÑ  H K€! .  
 …9q N  ?=)  IfJ‡ > .c€! .  
   .
 , •# /
?  
  Z7Â", 9! 1
. ) . 1#
" . ]   @ 
  
  )*+ > .? 
 ! 
"!) #
r!R# # !? .^=.
Ü,q! 5*+I 
\",*1
##R ‹", "?? ig#
"
5  ]
 . &p 
v `
 ?=>=) 1=. #
  
Z  ] 
";
; "H  
 #I   *( 5 @ 
,_+=) Z
#? ,!  =) 
  
N ! # T*( 5:R D*+d*+R Z IÊJ‡ > .R*(
 <#rr =) 
 (  T*( 5:N 

  @  R
!
 *+! 9/"??€ @ 
€  , .!  ͟.9
   "H  
 #*( 1 Z
 *+! 9"??€ @ 
,]?
 N  ! . Z#
( (=)? 
\ 5? @  ;  
Z  *+  I
135
Figure 22: Eléments de base du méta-modèle d’UML

` `
 ‹
 
.=)  q?! (
+ l 5  D8ÊÑ "? @  D  ‹  
Z  *+ ?! (
4 ¡ Z

Z
 
# Ij“ F *+ h .! ‚
a 
"   !K ‚N .#c : 5  9[:?]  ?€
*(   
N 

  ",  1?;#*+ > ##;",!/ H_
! 5 €  œ ! *(!  @    =) 
  +
; /*+ 5
ç
*(
< 4  !
%#E)tuI
k 4 *+ 5
çñ*(
< 1
!&
  (  *+! 5 @ 
H>] ! 9  "#   + 1
. =)  -?!   
‚
, . #  h_
   &   \  @   h . -   -",? . ! 5 
IJ‡ \  *+! 5^?! 
") 5-" ç
#< 
I
© ²c²,¬.¤# ¦ ¬hÅ
³ © ²;ÖÊ  q *+ h .! T 
"   !- r! *(!  @  T :  *(! 5cr*+ 5 ç
ß
*(
< [
!I €*1
 [
#
# !! .K  € "?!   F Z

Z
/b! ]F  K

v
 
Z.*1*+ÈÇ" 
?!&qŒ ! DBŸ.! .G È, . #  h_
  % € "??  '&XXH_ *1 
Z.
$
 @   @ 
?# # !? .;  -" 
?! ^
+ ;*+  >
çñ*(
< 
%#E”ØI

135
Pierre Alain Muller, modélisation objet avec UML , Rational Software Europe, avril 1997
136
Il s’agit du méta-modèle original tel que défini par la spécification d’UML.
137
Parce qu’une exception n’est rien d’autre qu’une classe

©Kamal AOUDA 2005 www.kamalaouda.com Page 59 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL


[*( @  [ Ð =>=# . "?Ð! #ì
L"B .
a$

*( C a
L"H . a*("$
  Q 
[

v
  
Z.*1*+RR",
TN !    ?  &pD ! -BŸ.! .4 R, . #  h_
  % "B 5(& 9¡"?l*+d*+
H_
*1 I  a# # !! .a
 C" 
?!CN jhâðefÊ{ Ì JAeô F Q ,  Z N 
 Q" 
?!
v `
", "#< .&‚T ! Ê=. #‹ g*+d*+T"$
!q ] 
": q, . #  h_
  %  ! .>=.
"?)  &I =) Z
#q0Î
   , #1"? ^ =>=# #! 5\€ *1
  
I
Ì ] ! …"!#
p
, . #  h_
 &f 
=.? ] ) =)  @  N   N €
 , .:
/
a :*( 5
ç×*(
< [

!ì
C  *+! / ] 
"L š*+d*+Q! *(!  @  I Ì ! #*+? /Ð)  @  QQ *1
  
  
`
 
!   *+!   \H_
?_
*( - 
 "(  -",?=)  !
I #  ?
   . 4(] ) =)  N ! "?
 +# 

 "? -  5    "?4 +?]  ?€-, . #  h_
  -"!#
 +#]
 ? 91 -",*1 . 
`

$"FT N è( Ÿ#
"H Ñ- Z*+! pŠ\.
I . @  :"? a)
 .c  ]  &‚  a" @ 
 <#?

+ 
"$*1(N 

  ",  1 *+d*+-=.#"?+   @     -  *+! >\4*( 5
ç×*(
< 4

!I
138
Figure 23: Exemples de stéréotypes spécialisant les éléments de base du méta-modèle d’UML

138
Source: Craig Larman, An Introduction to Object-Oriented Analysis And Design And The Rup, 3 edition (October 20,
2004), Prentice Hall PTR, ISBN: 0131489062, 736 pages

©Kamal AOUDA 2005 www.kamalaouda.com Page 60 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

© ²·,¦«!¬¤.£¸ «!¬.© ²


=) 
 ??! Ê  / Z
) $
*+  ›#…  ",   @  [
 ] ! ] ) =) p  
ß ` `
 *+! 5[r*(
   ?  I q 
" =) ",  T8ÊÑ  N  *1
!‹
[qB_
! 5€ ‹>  "
  <#

  =.*(  !”I
kKN $
     y?! X€

) *+
    Z

Zþ 
# &V ] 
"  y€

# ?  
`
*( $ *(  @   (4 ]  "+ N è( Ÿ#
"H JK, . ! Z
ZI € *1
 4
4 1=) Z
#;0 & 
` ` v ­
",! . ! .  Ô,7 ¥ jhI @ ?  h+
_ *\ jhI“
.
 
" I“
) "," ÕA =) 
 Ê N  Z
) $
*+… Ê  ",  

", "
  4?,ç 5 >B i] ? . + "$ @     Z 4 
.

 ”I

139
Figure 24: Exemple d’une contrainte associée aux éléments de modélisation d’un diagramme UML

© ²r ¬¸ æ¹ © ¬>¬.© ²-"H#  ! -9S


g",

 l~)* & ] 
5ƒ @ 

") 4  ‹
.
) . TN 

ß
 *+! /*(
   ?  Iaef   1 .! f  4 > #) 
! 54*+ 5 çñ*(
<  
) "$
 ?!! f 
! *(!  @  : [  *+? 5 @  N     @   =) ! %5žñØIKk [€ *1
  [", "# 5a  i N !    ?  
   @   h . ;!.? œ

 ;
  
."$   ;!
"H  
I 
 a*(*(! ”&   ?=h=) œ
v
# .
  @  1"!N  , )& ? #1! #  &
 
  - (  @   > .  @  1?? 
 . 4  4*+  ) @   
`
   h=.*( "?+ 
  \ 
Z.*4*+ ^N 8ÊÑ I
` `
N 
 € a3\

 
   , .; 1
.=)  ;8ÊÑ @  ( ]1#
"?! (  j“? .)  ”Ij“? ,
 *15 5? g . @  T"?5 5 cN ! #r?€?! \ =))
 N  
    ]  q  ]
     q
 ",
#
 + N è( Ÿ#
"B Ñ\
Z*+! Š\.
I

139
Source: Craig Larman, An Introduction To Object-Oriented Analysis And Design And The Rup, 3 edition (October 20,
2004), Prentice Hall PTR, ISBN: 0131489062, 736 pages
140
Basée sur la définition donnée par Pierre Alain Muller dans modélisation objet avec UML , Rational Software Europe,
avril 1997

©Kamal AOUDA 2005 www.kamalaouda.com Page 61 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

3.2.2 L’essentiel sur le UML Profile for Schedulability, Performance, and Time
â  #4 Ÿ#
"H  =
-"? h .+!
"H  1 N  , 
\N  ( 5 ? 1",! .
(1"? 
. =) ?*( 
‚

# !! .  1  *+? 5 @ 
  )*+ h .! N 
 .     "$
*(ÉB1 f   *+ ) @   4
`
 >=.)*( "?;  œ  ( 
Z.*4*+ (N 8ÊÑ Ij“? , • *45 5?  . @   "?
. =)  N  , •

 r!
 T .)  ] g
?  
 I‡JK*1*+gq N  ][]

q r!
"H  r
#
"? ! .&Ê 
`
 5  ô8ÊÑ  , c€! .  
 Ú9ï N  ?=)  IJ‡ > .V€! .  
   . V",?=#<#Ú?€š @ 
   Ð
 ]  
 *+! 1 D. -¡"#
;  ;
. #S
5 =) p; S
  r r, . #  h_
   &A 
 @   > .   œ ",? . ! . 
I 
K #a> ”&/#
",*1*(  N !    ! 
.=)  
v
, 5
. ! \",*1*+Qð %5ž‰%œ#"? @  s
v
j“ \?? 
! ^    (*+   
.+ > .)\; N  , ) I
“j   )*+ > .? ?€ @ 
  F ]  
 *+! 
F  
!‚N 
a# =# #?  ",*1*1

N 5 .=."B 5/"? @ 
 , ‡
c
"? ?  . a
F  Z.
F
.BŸ# 5a ]  
 *+! @ 

=.!  ! .>] 
  ^"B .
5-€! .)  ^9 N ! # ) !I
“j  L?! F 

5 . Ð…
   
.Ð
. =)  .C … 
Z "  LÚ*(
   ?  ì~”‚  
? =5 “’# 
& ‡$?
 _&?è- Ÿ#
"H .
) Z;f => “’#ÝFƒ'I

J‡ ; ”&


 
. =) ð !1",*1
!11÷1?,çñ
.=)   @ 
H?! 
"!) 5-?*1*- #*+! 
!
v
 + 5
  3,7I
Tableau 15: Présentation sommaire du profile UML RTP
f?çñ
.=)  k !") !  
{
)
 ï  ", "?? 5
&V
  .*1  
Z   ï   *+! 5 
`
*(
   ?  
p
??" p?€… 
Z.*1*+ aN 8ÊÑ  c ?=.)*(  
 ??
#"?  @ !  5  ]  š 
g  @ !  . UU!>]
 "?±~.Ò^fƒ‹± N ?]
 .
 *+!

$?_  @  È “›#È 
Z @  WΠN 

  ",  È~#",*4*+Œ¡!€ *1
 Π
"," . 4( #. .*+! )&  1  
 
   . •ÝFƒŽI
{
)
 ¡
±!*1
 WW, . #  “_
  ï gN # @   > . ±
¡*1 ?€
` `
#
# !? .F C", "?! G .*1l 
F  l 
Z5*1*+ lN 8ÊÑ I  
 *+! 5Ó *(
   ?  Ó=.
)
 —]? ì˜ 9z  z  *1
 
ð•*1
! @  !    . 
.BŸ# .
œ  ( 
Z.*1*+ (;! @   "?Ij“ 1 *+ h .?
N 
 .i  ?=.*(  q   ",
r
 c" 

 :",*4*+; N $ 
#T
 
!  -=) (N 
 +"H  ]
 . &?? ) 
 " . &  ( .*1\N  > .? .•Ý

141
Cet acronyme désigne le UML Profile for Schedulability, Performance, and Time

©Kamal AOUDA 2005 www.kamalaouda.com Page 62 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL


 .4\ 5
  

f?çñ
.=)  k !") !  
{
)
 T V, . #  h_
  
&[ ô  @   > . ô T ô",! . ! . U

JK "
)#?    . *(
   ![  P
  
"H 5P", "
)#?   PN 
 Q

  ",  LLQ?
~#", "
# "B_!ƒ ?]
 .
 *+? -*( . )  ›” 
Z " ~#",*1*+R N €
"!  q c $
# 

 &p  
 ?]",  \H_
 "$ .  ^ 
H_
"$
.   &+   @    ÝFƒ
{
)
 ‡ a  *+? 5F*(
   ?   @ 
• )*+ > .? ‡q#
# !! .
 
 =) ",    …", "?! 5[r
 
 =) "H  :",*4*+r  :
) ) . 
&K  :
#
"?  "? 
&
v
~#"$  
 
   h_ƒ   4 ]  *+! 5+
"  "!$ 
.;~> ) Z
Z.,ƒŽ& /> 5 Z œ N  =>=#
"H 5  1 
# ??
#"? Ý
  çðf *+ {
)
 
š!*1
 ÚN €! .  š
c

? 5q  M  *+? 5Ð
J‡è+ÊO Ì *(
   ?  S-?,çñ
5 =) ?
 
 =) ",  (?€(

  ",  (JKè+ÊO Ì I
{
)
 [ Ð  *+! >Cô*(
   ?  Ú
 ! . Z#  ì*+  
# 
`
@ !  5  ]  4 F >=.*( "??€; 
Z.*4*+ 4N 8ÊÑ Ie 5! 


>=.*( "?
v  N  Ÿ#
"H  =L
# !!  ?? &+²!©¹
¨ ²G·?©¤5¬5£¸ «²D¥©Ð·?© ²l¨ ª+©«!¬5²D²!©¤.¦«?¬
 ¬¹¥¸  ²(¥
£«²+¨ £1² ¹
¸ ¬.©+¥©4·?© ¬>¬.©+²!©
·H¬¸ ¦«¼

142
Figure 25: Structure du profil RTP

142
Source: OMG, UML Profile for Schedulability, Performance, and Time Specification, September 2003
Version 1.0

©Kamal AOUDA 2005 www.kamalaouda.com Page 63 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 ‹  *+! 5rS*(
   ?  ¡#   =.r?€¡ >=5)*( "? r?? (
") 5rg 5 K

 N 
 € 0I•k‚"?  ,?/ N   /!    ! @  N 
??ç”!*1
 "?   *+! >

 a
;BŸ.! .f?€  
Z.*1*+ 
 ", "$ F 
!   /N , ."H   œ
",*1
 €
 . I
`
.T"$ €TD #T! $ 
Z D ]c"?",. D D ) *(g9D g *1
  " . &‡9¡ 
#
# !? 5  ]
 . 4 9      
   . I
k‚+ +=) Z #40÷s
•¢ ©¤>¶)ª(£« ·?© ¦«!¬.©!§!¬;5
??*1
 P  ‹ =>=# #? 5‹!", ) 
D~ "?) 
ƒ @ 
p )*+ > .? +
é v
 
" =) D  ï >=.)*("? ôX N 

  ",  UUY?ï?]
 .
 *+! 143 Ic
R  
`
 
Z.*1*+ 4N 8ÊÑ "? (!"? ) 
4?? f# # !! 5 49F N  ;, . #  h_
  % Ì ",! .€! ,&I
v
k‚+ +] 5  ( =h=) "   41
.=) !ð  "
 1   @   > .; N  , 
??"
49 % Ì ",! .€! ,&I
v v
¢ ¬.©³S# # !? .¡9G N  ! . ) 
4N 
R!"? ) &\  l 5 P5  "
  <#¡ D N €
"!  
Õ
N 
 4"H   %5ž”ž If(, . #  “_
 1 , % Ì H .-  &I?ð_

 @  *+!  H , 
 . 4    \"H  
v
T  *+ ??
Z … … 
Z.*4*+ …q! @   "?r*( c"? ^?
Z‹ N  , ^
  *1 5  =#%5ž×ouI
   
.G  @   h . C *+ h .!  @   =) [  P  *+! 5SM*(
   ?  L?€ @   
v `
Ì , .'  &+ H 
,?" I  +
 + 5   ! 5\( Z
.1?€4  ? \4"?  ??B?! s
%
v
Ì #  !ðf *+s, .*1^;. !4+• .I
v
Ì *(/sH .*1i 5 5,# @ 
 +
€
"? . 1• .I
v
Ì #s *1
#+-=.  @    1œ .( , #   . +
+
4*+d*+4!"? ) I
v
Ì   _s!  BN  > .? .4! #; N €
"!  (+?€-1
   
.\œ .I
v

:¦/¤ .?¨ ¦
£
¥± *+ î
" =) ‹ ï"$.ZîV . ]  Icef  U H r# # ?! .
î  ‹  
` `
 
Z.*1*+ (9/ N  ; -, . #  h_
   % Ì   

 &1 % Ì " 
!  

 &I    
. =) 
` v v
Ì   

 &[",)#  !c9q
c*1 #a]) 
 …# @  d .  @ 
 
 Ê
 … , ) 
!  
%
v `
, 5  H  @  


I % Ì " 
!  

 &/F#] "$   Z [
F*1
#=) €N !    ? .
.
v
@
\ ! ..
Z ?!!  ] 
"S N 

  ",  SS?P?] .
 *+! *( _ 
? /
l .*1¡
`
# =) €
 ±~> $
 
Éì  *+ ƒ¡! #X  ô =h=# #? . ï ! 5."H   I  ï
)  "   î  @   > . 

??"
 \91"? \,€(H 5 #  h_
  ^?? s

Ì
 ) ) h_s 
) ) . +; 1"$.Z4( #. ]  I
v `
Ì "?"
)# "?s! H ) 
!  (, 5  ,  @  4 % Ì   

&
v ` v
Ì 

   s? 5   4 % Ì " 
!  

 &1~.?   !*1
#+N !    ? .
.,ƒŽI
v v

143
Par exemple il peut être utilisé pour décrire un scénario d’heures de pointe pendant lesquelles la charge de travail
traitée par le processeur atteint son paroxysme.
144
Par exemple l’initialisation d’une servlet
145
Consulter l’annexe 2 pour connaître la liste des méta-classes associées à ce stéréotype

©Kamal AOUDA 2005 www.kamalaouda.com Page 64 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

¢ g © ²?¦¹
¤#·?©g   Z D
q  
   =\ 
+  @  K  :!"? ) 
?? \€
"? . T~#",*1*+D
€ *1
 s

."? ?! ”&
1!>] 

 /

 5  , 5"ÉB
Z ƒ'I % Ì $
, 0& )*+ / 
` v
, . #  h_
     \ 
Z5*1*+  I  + )  "   \  @   > .  @ 
? 
B?? 
,?"
 \?! )s

Ì !    ö!  s",#  41*1


#+N !    ? .
.\", "
#!   
I
v
Ì $
.Z$

! )s!",#  !1( 
 )I
v

146
Figure 26: Sous-profil de performance tel que défini par UML RTP

â : N  .:
:
 :  c
: q !") !  … …  *+! 5aq
.=) ð #"? @  
‚
v
P  
?P ?*( PC 5C  P, . #  h_
  G   @   > . C "? ?? # C

`
 
" =) \  *+  ) @   [‹ g5  q0T 
\  … 
Z.*4*+ …N 8ÊÑ IKJK*4! . .
:‹ 
! *(!  @   @  N   BŸ.! .! ^‹*+  5
ç×*(
< g"? :, . #  h_
  q \   @   > 5 r D ?] ,
d #r
 .  @  r  (  : 
Z.*4*+  @ 
#!=) < 5! - *1
  " .*+? iT€ 
  " .*+! -  

  
"H 5^ 
 ]! 54s

à £
² ³ ©
·H¬¬.©ª1³¦¤#©¨“Ö @  N 1# .?] + 
  \ 
Z.*4*+ \+! @   "?;*- \? B 

• ß
  \ 
Z.*4*+ ^N 5   N "H  ]
 . I

146
Source: OMG, UMLTM Profile for Schedulability, Performance, and Time Specification, September 2003
Version 1.0

©Kamal AOUDA 2005 www.kamalaouda.com Page 65 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

à £
² ³
©
·H¬V·,¦¨ ¨ £´¦¤.£ ¬¸ ¶fÖ @  N  # .?]  €

  " .*+! Ú 
U  ™ 
Z.*1*+ ™
• ß
",  .  ,›! @  "?4
5" .*+!  
  \ 
Z.*4*+ \4",
^N !    ?  I
à £
² ³ ©
·H¬
¶.¦« ·B¬¸ ¦«
« ©¨ Ö  .͟# .   -",
^N !    ?  I
• ß
k  a 
 .Fa"? > .F?
"H  a

 . ?€€ *1
  ", "# 5  
‡ N !    ?  
‚
1
.=) !ð 
 
" =   +  ? \1 >=.*( "?I
v
Figure 27: Exemple d’annotations ajoutées aux diagrammes de cas d’utilisation

<<PAopenLoad>>

{PArespTime=('8','s')
<<PAstep>>
Visualiser le contenu du panier <<PAstep>>
<<PAstep>> d'achat Afficher page d'accueil
Log in
<<PAopenLoad>>

{PArespTime=('9','s')

<<PAstep>>
Recherche par auteur
<<PAstep>>
Parcourir la liste des livres

Client

<<PAstep>>
Ouvrir un compte

<<PAstep>>
Annuler une commande
<<PAstep>>
Passer à la caisse

`
 =) Z
#…0‘q   , #  [
)  " ?€…",
FN ?    ?  [
…
a  .ca] ? 5cq  ]
#Iœ

…
"? > .1=) Z
#4 ]+ 
" =)   .*14/# !!1 .*+ @    F
ZN "?"  

 N  =>=) "$ ×Iâ‚+ ]+
??" /  , . #  h_
  % Ì , .-  &1;",
+N !    ?  ÍÅ  =>=) "$ 
v `

ZDN "?"   NA
;*( @  ;
 ¡  5 S*1N ! # r
R N !    ?  gg  .I 
.*1(~ Ì # ,ðf *+ ƒ H !€

) *+ 49  N  4+",

 ;~~ Å xN & N N ƒ  Z
 =) ! x+!
", 
I
v
ÃMÄ Öj“? , • *1> 5! ! . @    (H . #  h_
  ( •  +   @   > . -  . =)  ð  ?] !
v
    Z ? ?
 4  +>=.)*( "? \?
$ .
  @     + h=.*( "? -*(  
#
 !5% žñØI

147
C’est à dire les performances réelles.

©Kamal AOUDA 2005 www.kamalaouda.com Page 66 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
  
Z.*1*+DN "H  ]
 . RS R=) Z
#D0xP   , #S  R ! .."H  ‹ 1  ‹",  .   
D

"? ?? # L
/=>=) "$a  L ?=.)*(  SN 
Q
.

 9ì5  /C
?€Q
! S 



 \ =>=. #? . !%5ž×„uI


+"?R 
Z.*4*+RR. .?] &A? #R! ## 
&Ê
 g  ",  T 
4 l*1
#RN "?"?< 
", "
)#?   T~7ÒâÊ8‚!.,ƒŽ&p
 ‹ H  *(  ‹~# , >ƒ( .*1q*( _ ‹~*+ !ƒ1# @ 
 T~~Å # @ N ƒ

D",*1
 .D"$ @  Wœ .&:   @  N 
 Π  ",  Y 
l ± .*1îÇ# =) €
 
~ Ì €k  _( Ì   _ƒ'I
v v
 
•!;=.*1   ) !•N  ]! 5
Z ] 
";  1  *+! 54;??çñ
. =) 
ð  f F*(
   ?  
v ` v
8ÊÑ 
(  c

  ",  cr",*1*+#"?r  
"B 5
 @  gq#
",*4*(!
q R 
"H 
#
 \?€1  ]
# \ 
 ]? 54s
 ` `
fO ) "? ’i!k‚Z 
?
& 4ðf *+U8ÊÑ s Ì  ] "? š Mðf$ U8‡Ñ =.  çðf *+
• v
•_, .*-
&ðf$
 .e  & Ì 
 ?õ   _&œ{
)>_02&02
2 &fj KOâps2 ç”Î 03HçØ3,÷
2
‘
÷ ç)0&
­
‘
7 0
Z 

k‚Z‚
!
 .Zq&fø•
 ", > ”& Ì 

 _
 Z8‚!cJK
!:k‡) ] Fè( Ÿ#
"H ÊÑ-   Z’- $
• `
8ÊÑ s Ì  Ì 
 5 . F ç×JK*1*+#"?[e€*1
 & Ì 
 ?;õ   _&{ ., ‚e   b 
 :3 &
­
02
23 &
j KOâps2 ç)023H甑
Î
2
Î ù çØ3 &3,‘
÷ 
Z 

148
Celle qui contient les prix est sécurisée mais celle qui contient les autres informations relatives au produit ne l’est pas.

©Kamal AOUDA 2005 www.kamalaouda.com Page 67 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

149
Figure 28: Exemple d’annotations ajoutées aux diagrammes d’activité

132 4 5687 9:5;<5= >5= ?A@ BC(CD5= @85DEF5= >5= EF5@G= 5IHKJ7 J;J<5 HKJ7 J;J<5

149
Source: Early Evaluation of Software Performance based on the UML Performance Profile, Gordon Ping Gu and
Dorina C. Petriu, Department of Systems and Computer Engineering, Carleton University, Ottawa

©Kamal AOUDA 2005 www.kamalaouda.com Page 68 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

4. Gestion de la performance dans la phase de design


k‚1"? h .5   !!. @   ,  ;N ]   N  *1
"H 1   Z; 
f    >=5)*( "? + 


  ",  ;",*4*+."?  
"H .
 @  I 
>] 
 f9F", œ Ÿ#
"B  =
?!.;
v
#]
 ‹
   
.…!  çñ > 5) @ 
#=) < .? ^  c#
.F=)# @  *1*+? ",*4*1 ! …
 
   Z :",*1 ?! 5c  …#"$
 . "H  # c,€ @     q  c?! \ ! . Z# 
I Ì …=)
^ 9
*+  
#SD
. !.‹ D h .)!D
4"H)) Z1"? g#
.rRl# 
 #P  
",! @   "? 
I

4.1 Impact de l’architecture de l’application sur les performances


`
 (#"$
 .
"B 
# ( ( 
  ",  ^’i4 ]  

 ++b! ]# <] ! ",*1*1
 *+? 
 N 
 4 \?€+", . Z
)  \ 
 ]! . 4s
Ì #"$
 .
"H  # Ñ-
 3

4? Íb "?? ) "i."$
 .
"H  #I
• v
Ì #"$
 .
"H  #–Ñ-
r0 @ 
‹ , Ð
 ¿

! 5  n™ N #"$
 .
"H  #–Ñ † JÊ%.o׏š!€



  ",  ’iI
k‚  # , ."? > .?
"H  1€*1  .!  N  *1"H "? 4?€;#"$
 .
"B 
# 4  
  >=.)*("?4 ^

  ",  \4",*4*+#"?1   "H .
 @  I

4.1.1 Architecture Model 1

k‚-"? h .4#"$
 .
"B 
#;  ^b " *1
 ! ?€4.Á  1s
v
J‡ 
 ",! .Á 
‚"$5Z  ) ZK  /# @  d . ! .! . 1] ./
b! ]!cO•  @ 


 ", 
 + 5? .   
Z @ 4N  =>=. # +
"? ,? # !
  i . .”I
J‡ 
S g]
  @ 
p )*+ -g"  ! -N  ! ..
Z - ] 
"‹ N 

  ",  g -N  =>=) "$ 1 

#  
 5  i #. .*+? 5^=>=#
"B  ( +b! ]O• I

Figure 29: Architecture Model 1151

150
Cette architecture a été initialement conçue par SmallTlak au début des années 80
151
Source : Govind Seshadri, Understanding JavaServer Pages Model 2 architecture,
http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html

©Kamal AOUDA 2005 www.kamalaouda.com Page 69 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Ì ] ! @  1"? h .4."$


 .
"H #
#  4!;# &   \
]  
 
.\ ] ! ",! #
*+4 
 "?

5!  ;",
+b! ];
!-
 -!>]
  > @ 
, 5 ?  .
"H .*+? 
 
 -9>  N 
+  *1
 
` `
=.*1
  #òðÑ I  -!>]
  5(",

  ! 9M 4=. 4  
Z @  1N  =>=. # (   4 , ) "B  !
 )*+ > 5? 1Z #•  4 ! .."B  - ] 
"+ 4]
 I  \ 5. HN  ,  ] # @  ;"?;",

 
Z
v
#
  =h=) "   F#?    ?
   .  ",
& *( ! 5 "? 4

  ",  + f # >   
 \9 Â"$  \+! + - @ 
   -1 ]  
 *+! ”I JÊN  ,  . @  N +1 "  1*1 Z#
] .+ N #"$
 .
"B 
# Ñ-
 3^(!
"B  
!  1",
1 
   *+!   " \
+  \!>]
  >-
?€1>   +
 ( H   "H 5 -",*1*+; ;*(! ##  (=) Z
#40ùI
p"?l
",

 
ZG#L
 r=."  G L*( ! . "?S  L# 5   D ‹ 9Â"$  
&i 
 ! .).
Z
  q 
  , .? @ ! \9R?R *1"H \  4  ‹ >=.*( "?  Iiefr=>=# +
 q
BŸ.! . ;", "$  ; •
 ;",*1
?? 519a N 

  "?  &
 1 "?".,  ",?*4*(  
 c# ?,
#"? …
"? ?? # c
 c=. #[=. "H  
 i~*+ *( #&J 8pI>I ƒŽIfJ‡ Ê.Z *+?
v
5 \N    
.q??] ! \" . ¡4  q#"$
 .
"B . q +  q ]  
 
.‹!
‡Ÿ),  =) 4  
#  "? "?a=."?…9q N !    ?  a Ô > .)
Iœfq# "?]
   . # , . 
*(  !"! 5
 I
è(R ? + 
\

 ^ 55 \g. ?T  
*4*+! ^¡ ‹ 5   g¡ N 

  ",  &V 
*(
 =) ",   @  N r",*4! .D 

5 .+*( ?  q",*1 . "? :D N @ 
  ‹
 ]  
 *+! )I
`
", "?! #.  11 5!  ",
 
;  +!>]
  51# , .
   .)  ]    *1
 / . @  N 
 ]  
   +

  ",  +; #< ;   .; 5   & ?€ @     + ",*1! ./
+BŸ.! .

?]    a=. "H  
  . c ^ . @  ‹  … ]   
.…?! ^ _?] ! 5!%.o”6uIÊk‚
c .
!"? ) 
 @ !"!#
œ
4b! ]FO• ; •
 ;b  ?1 
?  
   . N  ! # 5! . 
v
 
Z @  :T
# !! 5  c ÊN  =>=. # a
!c
 :!>]
  ”Ifè(! ##T r*+ *( .:

  
   
@  N  H=.!    f
œ 
f , 5 "   &
"? ? 5,' . •
  Z*+! 5  14 .*1(

# ! #"? @  ; 1"$*1 +*1 )
? .   (# @  d . \]
 ? 
 ( ZI

k‚1  (

  ",  (4 5   *( _ 
 1 ]  

 1 + @ 
   4
 ( 
"   !
 
&
  \.Z
*+? 5- ] @  ( 4?! 
 +#
"?]
   I
j“H ,
]
. @    N BŸ.!  \",*1
?? 5-
 c", "$  [Z*+? .! ^ : .*1[r# !r*( c",*4*+‹: N  ]a]
:
: 
5  /0& [ >=.)*("?F N  , ‚
1!
 *+! 
  =h=. #/ .*1*(  Z
 *+! ‚
 
 =>=. #+1",Ï? 5 I

152
C'est-à-dire qu’ils sont capables de développer en Java, HTML, Javascript et tout autre technologie qui peut rentrer
dans la construction de l’application

©Kamal AOUDA 2005 www.kamalaouda.com Page 70 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

fe ¡N ! # ‹ .*+ 


&- ‡]. *1 ?€¡?") =)  @   @   l*1    !
", Rl .*1R
# !  !;",! #5    ! 
",*1 !
 +?*4*+ + 
, >!     + 
f  4",Ï! 5
 *( ! . "?1  
  -",Ï! 5\ -)# .\N ) Z   $

*(    *1
! 5
  ^9 *(?] !
# >   ‹ 9 Â"$  q‹! ‹ r @ 
   T
g ]  
 *+! )I^Of g !]
 *1*+? ("?
?") =) "?4

.
 ",*1? 54 (*+ #) @   -  + "$
*()ÉÍ\ !=) 
 \
+ >  40I

4.1.2 Architecture Model 2


`
N #"$
 .
"H  #Ñ-
f3)*+ ”&•"?5 . 
&N  ",
 p  
Z @  [N  =>=. # /
a  b! ]!
O• ±*( ï  Ç N ]" Ç
ï?  <#*+? ¡ X",
±b! ]X îb IqJ‡ Œ
!
v
N  *15 5? 5Ð
.
 <*+ GN €! .  
   . ì Fô*( ! . "?M
Ð  L

  ",  L
Z.î 5   U ]  

 îT V @ 
   ì #< Ú  "   !
 
I…J‡ î
.
 <*+ Ú!
#  
*+? ",*4*++ 
 s
`
 ¿ @ 
   —™ ]  
 *+! Q 5*1 ! š.
 *+! Ð
˜ z
 <
Z™z 


",*1
   S=."H  
  QL"?C! @  N   
P"#
! F
 M,]   Lb 

v
"$ @  S?]   g=. "H  
  . DS N 

  ",  I\ef   r!S# .?] ? ( K ] 
"g

*1
#4€)
 5! +b  
   
5+  Z  \4"H
 *( =."B 5) ! I
v
`
 #
. N ) Z  …$
 *(  F![*1
  
  ! K."? @  …  /*+*1
#  [ N @ 
  F

 ]  
 *+! • 5 "$ ? œ"?" ! .  *+! œ9F +=).
Z*+! 5;F",
 @ 
[# <] !

D 
.: h ) 
?  r~)-€ *1
 D
T   Z  @ 
 .<#‹"," ! 5  *+! ( 
`
",
Úb! ]ô . @  N   N  , :"?! š . ]    @  V 
T ï>  ïòðÑ &FJ‡Œ
b! ]
!") ! >ƒŽI
`
ï# ? !  šô"?U.
 <*+ô€
 Z  q
 V! #V! .  Ú! #î ï 
Z @  V

# !! 5  ; œ  
Z @  ",
.    @ 
  *+ h 5 ?€+b   ) Z
f  ;# @  d . 
v
] .š  Qb!]ïO•  I/JÊN  , …   @  N ìU.]
 ] î N  " 
 Ú#"$
 .
"B 
#îÑ † Jn
*(  ð É @  /
 a
‚ N "?",
  /!  ! aÑ- 0/. ? F N !    !  ", Ÿ. ! .
 qb  - T!>]
  5T
g S*+d*+R

  "?  I^efD
 TN BŸ.! .1
 R!>]
  -9
v ` `
 N #"$
 .
"H 
#F  =.  "!.
f   ! ú  AÑ ",*1*+bœð   ]" f!  <#*+!  
",
¡b! ]S ‹b I Ì ? 
# *+? ”&^"? SL *1 g?€D   Z .gl  
!1N 
 
v
H_
! 5 €  @ 
 
‚ ,    ",
a
 ;=.*1   <#…*( a"?",
  
 …
 FZ*+! 5  / 
# ??
#"?  ",?*1*+
   œ .*1;a# !?a 5*4*+! f/. ? .  Z 
` ` `
  !  AÑ  Ðw N !    ?  Óz Z

Z ¿",*4*+ ‡  ‡ ð 
Ú  
.B=.*(  ^  
"H! .
+  1Z ,  (; 
 # !! 5  I

©Kamal AOUDA 2005 www.kamalaouda.com Page 71 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

f
  ZG   
. @  Ð  G# @  d . G N ! 
  @  N 
P!
- ! N ! #
P] .
 N 

  ",  C . @  Ð
Q N #"$
 .
"H  #šÑ-

3P"$ @  Qb ",H   š
M !
v
N ! #
 4? IkKN *1

; 
). •
#   *+ @   "?;   Z 
. ] @  
  ",Z ,  
 X# @  d . YÇ
 ]  WX",! #.Á 
l l!l",! @  ? S
Ç# >.Ç
X 

"$ *1  *+?
] .S  Ñ-
 I

“j  , f *1> 5! ?


  Z  @    > .)Ñ † JD 
.
!"!) f
  "#   ;
   
5
",! .Á 
5a…! …T r*+d*+:#"$
 .
"H  #I 
A 5 _ A"? > .:=>=) *( # c
v
 )*+ > 5^;#
. 
 . 
+€? . 4  ]
#+b!0ee[k   Z  h .)!%.o×EØI
v
LNM
OQPSRTPSU VXWSY[Z[\SVZ^] U \K_)`ba3cdY OQPfe gSg#hiOjZ PSUZkPSRlhiOj] Y[Z PSmSn \TopgjUrq-PSRAstPFuSu n Y VXPDZ Y gjRSOvxw:]SZ

O gjq)\lZ Y q)\3Oyqzg3U \'Plh|{PSRlVF\Sh}u Ug#VK\3OKOKY RKeY OxVXPSn n \ShzopgjU0_DO g-Y[Z~O-Z Y q)\Z g-O3Z PSU8ZSo[Y n n Y RKeY R€Z Wl\'W#gjn \3O

Y RZ Wl\‚`ƒa3c„PjU VXWSY[Z[\SV Z^] U \K_OjZ PSU8Z Y RKet… Y[Z WZ Wl\†VFgjRDZ Ugjn n \3U v:‡gZNgjRSn sƒY OˆZ Wl\†VFgjRZ Ugjn n \3U‰Z Wl\‚o[Y U/O3Z

uIgjY RDZDg#oIVFgjRDZ PlVZ(opg3UU \SŠl]\3OjZ OX_|Y[ZY OzPSn O g‹Z Wl\xu n PlVK\Œ… Wl\3U \†…\rWSPN{\Z Wl\rqzgjOjZu UgFe(U/PSq'q-Y RKe

PSRlhƒhS\3OKY e(RŽo[U \S\Shjgjqrt‘l’b“ƒ”3•f– —˜^˜p’3™/š›jœ#’3ˆš#œl˜ž–’SŸX  ¡ ¢Q‘#œ£i¤-—SšA¢¥ŸFœjš˜ ™œj¦ ¦ ’3™/Œ˜ ‘l’3™ ’

K‘#œ§ ¦ ›x¨l’
.”

Figure 30: Architecture Model 2154

153
William Crawford, Jonathan Kaplan, J2EE Design Patterns, O'Reilly, September 2003, 0-596-00427-3, pages 368
154
Source: idem

©Kamal AOUDA 2005 www.kamalaouda.com Page 72 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

JK*1*+ *(? # [=) Z


#cÎ3F :"#   a
   
.F",! #.Á 
.F",,*1*+
 
# ??
#"? /*(   [ )*+ f[# 5  K a"$.Z
/ . ]   
K
F*1
#[# , ## ! f
!>]
  5 IKk:"? h .[=.Ü,: _…T*( a:",Z H  a
 ]  [ [",? .Á 
.a A  
# @  d . ^) ] ! 
 +.
 *+! 94 H    I

J‡  ”&  N  , ‚


 @   ,  
 "? h ./!
"H   a#*+ > ##",!a [ 5    "?/
 N #"$
 .
"H 
#RÑ-
œ0D!
(
 r"?! 5  r‹*1    !
", :R
 :
!T T .*1c
# !Ief=h=# ‚ =."   . /a*( ! . "?  N €! .  
   . /?! œ?  *15 5? .  @  
  >=.)*("?1 
 ] ? d #;
) ! \+",*1? .4 + 4   Z(; N 

  ",  I

Figure 31: Architecture multiController versus architecture FrontController155

155
Source: Small servlets versus front controller strategy. From IBM Software Group Services Performance Workshop
presented by Stacy Joines, 2001, Hursley, U.K. © IBM Corp. 2001. Reprinted by permission of IBM Corp.

©Kamal AOUDA 2005 www.kamalaouda.com Page 73 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

4.2 Impact du design des composants sur les performances


k   # , 5"? > . ?
"H  &;
#;
•" @ 
  @  / N #"$
 .
"H #
#FÑ † Jg , œ

‚
"$ € ? 

 /
‚ a h=.*( "? @  !
‚ a*( ! . "?/  N €! .  
   .  


  ",  Mô",*1*+#"?ô  
"H .
 @  IFJÊN  , …N    
.M 
"? > .U!
! @  U

# !! ..+  ^!  çñ h .)\  h .)! @ 
B
 ]! # Z  4   ZS -"H*1
?! >
I

4.2.1 Anti-patterns et patterns de la couche de présentation

4.2.1.1 Les vues composites


`
 ",, #) "H  ( _
*1 @  1 4
Z ’i; ?!*1
 
Z11",*1
,? 5( H ] 
 


(, 5
.1-=. 
!(  \

  ",  \1",*4*+#"?4  
"H .
 @  I1j“B?=>=)  .",
) 
  \  . \4Z. \",*4
Z
  -",*4*+ef _(1O• , )Of?_1 ",H 5 . @     +
Z 
?! (S
 ‹¡ q=.Ü,

 r9P5  +N 
 ¡",  
"H  gP
 ", @ 
p

 !! 1 
.



 
   
.!
#"? [ ",  F “›#a , >! . , 5  @   F “›#a _ *1 @   [~)
€ *1
 sÊ
r
 " @ 
‚#
"
 <#T _
*1 @  *+? \  :",
.c c"H  a]
 R
!>]
 "?
’i&
1! # @ 
  *15 5  +


 +H_
 @ 
 ;~”…=#
 
?ƒf95  N 
+=) "$
 €
*1

 "? ‹ 
+
T  5r  5:r ",#D
g
 " @ 
",!  ! ( D 
Z
R -  r ?=.*(  
",?_
) Z$! '݃ŽI

J‡ > .M*(


 <#CÐ",H )
 #M  C
Z ¡’iS=5"   .ì N 
*1 
 , .  L
 P  . P a 
#!    ?
   .  
 ",*( ;  /",?*4*+F   ",
 F# ?? #"? 1"H*1*+F *(! ##
 4 
Z.*4*+4+! @  "?4 
 ]! )I

Figure 32: Génération dynamique des pages web par assemblage de composants (pattern du composite view)156

156
Sun Microsystems, Core J2EE Pattern Catalog,
http://java.sun.com/blueprints/corej2eepatterns/Patterns/CompositeView.html

©Kamal AOUDA 2005 www.kamalaouda.com Page 74 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

k M  C

  ",  Lb! ]  M
Z C?! F h_
  @  *+! [",*1 !
 C! š
 ì
‚

   
.\ i .
"$

 @   ( ?=).s
8    ?  …*+
",
  *(:N   "    ! . Z# :?€[b s
: c",*1*+q …=.!   

• ` v
=).*+ ÐN òðÑ &/"? h .š .
"$

 @  î )*+ …N   ",)#c9U š]
î
 î
ZÚ9
 N  ! . ) 
cN 
 Ú! #IFâ‚C] ).Ð
š î5  V7 @  Ú?š=h=) "," . V ,
 
.


1 h_
 N   "   /!    !
F~)  "  #
"H  ]  ] .   " "H  ƒ
9g g 
#q",! .
T  " ~., 5  @  q: _
*1 @   ƒŽIÊefT#< Z qZ  5 ‹ =.!
]
 .; N !    ! . @  ; 1",! .
4  ",)#  1 ! 
\d ##;*1 -(","!$ I

8    ?   b! ]O•  sœ  b! ]O• ?! ‚ /",*1
?! 5! )   ?
   @ 



=.! f*( ?  ] *+? 
 !?€

 . 4N ! #
!›#?5  ~×j ›#è^ƒK •
? 
# F .  , 5 "?
 
.  .
) . 
I †  @  "? 4
  +?! ",Ï! 5?€ *+ *( #&
.
"? ?!
œ
 .*1[# !&•  =.! # 
 #… 
‡!    ?  //, ) "H *1 
 *1 * Iœj“ =.! ? 
."?",
#" ‹ 
q
#
ôV]
 U r# 
 #Y 
r5 .
Y~5!",  ƒD q ]
 .‹
 
"?"
  r 
!   Tg g*+ *( #‹ . @  g ]
 ‹ N R
 q  ? IÊef,=) r =.!
 ?? _ •
( 5! . *(  
#
?  
 , 5
"ÉH   
. ) . 4 +b? ]aO• 

g ¡
! gl


 ¾#"? @  N    RZ<#!   ¡*1 ! g9TŸ.
 *1
  
  
~)

 . ƒf
 -!=h=) ","?*+! @  ; 4H_H .<*(4-=) "$  .+~)

 . \N ! ##
 ^?>   1j ›#è^ƒ'I

8    ?     


. )  ; 5
Z
 .?
  ! ~#"!, 5*C 5
Z
,ƒs . @  a /",! . 



.?] …
 5
Zc .?
  ! F
 a",
FN 
 b &• 
."?< Fa.   Zað
Z
` v
 
.>_¡k !"!) ! 54~h=) "$
  I  
ƒ (  .*1  4 D"$ *1 ‹N "?"?< q9S ¡" 
?!R9
  @      + 5
Z; , 

 ?? I Ì 1
,?
Z  H"$.Z(? ? +ð
Zò‚  
   4 
*+ $
  @ 
: *+ h 5! RXZ #D?W"B_ "! X±]
 ITJ‡ ï .  ï?!
   ?! . r? p
 ¡
; P*+ *( # @  l
; S
."? ?! ×IK   r?!
=>=#
"B 
 w9 
  Z.y
"$   y     ?] ! ô Z.
Y
)! > *+! ï 
 >=.)*( "?[ N 

  ",
 IfJK*4*+  /b! ]qO• & =.! p  *1 .A N !    ?  a 
5
Z
4 5?
  ! -+, # "H *1 
 *1 * Ij“Í=.? ? H"#
•
1*1 ## , ## ! 4ð
Z
ò‚ 
; # ?
#",/
 
• ]
 .;",! . 
N  , 5 " f ;ð
ZFò‚ 
9;"$ @  -=.  @  N  H". !;
\ 5
Z .?
  ! 4
!+ 1",
+  +b I
v
J‡ a K N !    ?  /… :*+ *( #a","$ Fa .!’!‡
",!h] ‚ 


 
 šô
Q]     š , c??] ! cN 
šZ.!ô
5 c
Ú N *+   .  š 
 >=.)*( "? \ ]
  ^",*1
  .  I

©Kamal AOUDA 2005 www.kamalaouda.com Page 75 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

\€ *1
 &K‹  q
T . 
"$.Z^9R*( ! . q#
) ! T
 r

  ir R 
Z
&p  ,
v
 
?  
   4, 5"ÉH•   F*+ *( #","$ 
.’!•;=.ÜH;9?
 
Z  . =) "
`
 
œ # ! 1 9/# 
 . 1 .*1(# !#Ü œ  "  ! ”I /
) "  ; =>=) "
 .
 ] 
"+"? > .1 .
"$

 @    5 9 ;=)# @   "? /*1 ? 9\Ÿ.
[;","$ Iâ‚*( *+! "!N  ,
!>] 
N  ] 5  Ê ["  ! ‡ . @  c  



/"$Z! ‡*( F*( $ 
#!*+? ‡  
`

.’!.[ … 

> .! Ê
F"?*(
…c",*1*4

 ",  I *(
< 

 ’i] !
@  a F",*1*1

 ",  , ‚ 
 
a  
.’!.
IJÊN  , œ
 "19F?€N   •] ) =) f9[ 
?
#"? @  l  r


 R N ! 1 ‹"$Z IiJ‡ > .‹] ) =) ",  g
 (d ##R"?",
  
   
  1 N !    ?  (1"? h .( .
"$

 @  4  d #;#*1 !1 @   H  I
â Ocs  1  
. )  (4 5
Z ( 
"   ! +",*4*+ è\JK"$ ; =>=#! •
 1? !  1",*1
 < . 
Ê
  *1
 l
+",
"$ (g*+ h #g 
-  @  l  T =>=# #? 5r",*1
?? 5TN 
 gb IJ‡ 
v
  
. # \!.?   
 ^ ] 
"(
 \+ 5  \
!+ >  17I

4.2.1.2 La gestion des sessions au niveau de la couche de présentation


`
  .?
  ?  W Y!>]
 "? Y 
P
±  5ÈÇ",*1*+#"?Ç  
"H #5
 @  Ô
?!
n

"? ?? #*+? ^\ r"H  
"H .qq


 :
#
"! ! … 
\  :  ? … c"  ! 5c ^ 
 
 ]
 [ 
.  =>=# #! .  ! .."H    ] 
"   .Iœj“! #) !< @  *+? ”& [
. 5", [$! > F 

#M
SG"$.ZQ"? l?€S9 Â"$  G#"? @  N  ^ , ", ÜC
a*+ h #P=) P9M 
",
 €
 ì",
.! .š<  @  ô š!>] 
F’iM?] ô
 ô# !š?€M =>=# #? . 
# @  d . :#
Ü   I Ì ]
.• #&‡ ‹
. 5", ‹$! h cg
 ‹*+ *( #T 
$ *+<#‹~.H 5 .  ?,ƒŽI
Ì 
#< 4  " Á 
#4  ",
 €
 4",
.! .&
 ! 1?1??]
 ! 
H ("  ! 5 @ 
H!  ͟.9 
#
",
./9c! /!>]
 "? F
 


 / #. > .
 [p   =h=# #? . a# @  d .  @  N   
! ?] _
 
I

a )*+ > ##C9ì N 

  ",  SõGC!C??] 
 / S


 S S"  ! 5S ] 
"
v
   @   4   1/#
"!! . ; ! ..
"H  
&  +
]  
 
.+! œ# ",
.(*+
",
  *+
 r! ?  %.oׁØI\k‚Tb!]l"? 
 ç”"‡ , (??] ! 4*1 ‹  ©?]
#S; S
  rR . 
5  =) "? 4s
© ²·Ä£ª1³Ó ² à ·,£·Ä ² Ö"? > . .
"$

 @  F",!  , .9… ! # /  ", /~5 5ÉH?ƒ
• ß ê1ß `

… c"$*1c","$ …N 
…=.)*1
  #gòðÑ %.o”„uIÊkT"? > .‹*(
 <#‹ N 

  ",  
#
",
,  4"  ! 91"$ @  (=.  @  ; N   "?  
H ,
#. *1 (
 ;# @  d 5 $! h I

157
Dans la plupart des cas les informations stockées dans les sessions expirent lorsque le client ferme le navigateur, se
déconnecte (log out), se dirige vers un autre site ou encore lorsque la durée de la session est révolue.
158
Champs dont l’attribut TYPE est égal à HIDDEN.

©Kamal AOUDA 2005 www.kamalaouda.com Page 76 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

© ²c·,¦
¦ .?¸ © ² Ö"$,' qq",."H .<# … 
!
q

…=) "$
  
\ q  @  q

• ß
"  ! ”I Ì *(  @  N    ;  ? ! œ
  @ 
 
&  + 

 +, 5"ÉH
 +
4", > ."$H'
?!  #.*1 ! :9D N 

  ",  :õq9g"$ @  =5  @  N 
 R# @  d .R 
>]
 ! i
*+d*+4"  ! ”I
£…¤#Â
Â
·¤)¸ ¬¹
¤#©/¥Ã g Ö"? h ./ .
"$

 @  F H f??] ! ‚!    !
[ . @  [ F"  ! K
  @  [ 
• ß Ù ß
#
"?!  F ",
É?   Ifef  …",  , .[9…BŸ.! .p
… !  =) ! Ê

 @  [9[ 5a  a  
$?_
 5 .€? .  @ 
B!( 5?]!  
 +]
 I Ì "$ @  -=.  @    1"  ! "  @  4
"? +  

 î# @  d .V",? .! : N  !  =) ! 

 @  V , c?] _
Ú9U N 

  ",  V
q 

 )*+ > ##4;  # ",
, #I
© ²£¤5¬¸ ¶)¸ ·?© ²¥Â
·¤)¸ ¬5²;·¸ ©×¥© ²?² ¹²;¶.¦«!¬•£³
³ ©¨ º¥© ²¥
¦«
« Â
© ²F¸ «²!¤#Â
© ² ¥
£«²/¨ £Æ
¹ ©/¦¹² ¹
¤¨ ©
ß
¥¸ ²?æ¹ ©a¥¹
¤¥¹· ¨ ¸ ©«!¬”¼ ¨ ²¥Â
·?©«!¬¤.£¨ ¸ ²!©«!¬Ê¨ £a»© ²,¬¸ ¦«/¥© ²²!© ²?² ¸ ¦«²£¹[«
¸ Æ © £¹/¥©c¨ £[·,¦¹ ·Ä ©
ë
¥©L³
¤# ²!©«!¬5£ ¬¸ ¦«¼ © ¬>¬.©l¥Â
·?©«!¬¤.£¨ ¸ ²?£ ¬¸ ¦«P³ ©¹!¬1²Ã £ Æ Â¤#©¤+¶.£ ¬5£¨ ©L³¦¹
¤/¨ £C³ ©¤>¶.¦¤ª(£« ·?©l¥©
é
¨ Ã £³
³
¨ ¸ ·,£ ¬¸ ¦«1·,£¤fÖ
`
N !    ?  GM C .
"$
 @  C P"$*1P","$ S ] 
"G ì*+ $
 è\œð•%.o”ˆq 
• v
",!  Z! .g q  @ ?  . Tq


 : "$Z

r! ##g r"  !  ^ q!>] 
”I Ì
*+  
# @  1"? h . @ !  5 1".,)   # ! (N Z
5Z1  + .*1\N "$ *1  *+!  
# @  d . ] 5+ 4!>]  Z*+! .
%.t׏ØI
` `
F#

")  #N 8Ê Z*+! .  .*1 
"? ?? #
•Z  #  ]
  f# 
 f  


?  
   . \ *1 !4+"H"$ I
`
 


  ] $
 "

 ! #… ["  !  ‡ a!>]
Ê F?! ‡!
# !    !
 FÊ  

 =>=# #? 5[",*1
?! >!%.tŽ%T N 

  ",  IKef   a
 ] ! pd ##T# ç”",  
"H .
 a9"$ @  
=.  @  N 
P",*1
?! SÐ  ? I;j“iL#  
 .G P# 

 "? ¡
P N ?]
›”#
"??  C G


 G [
 ì*(?] !C=.
"H >) ?  CC",
ÐM  ]  C 
",*1
?? 5
I
`
Ñ(d*+/N   N 


  
K  ",
É?   F …#

") # #N 8Ê & [*+
",
  *+/Z ,  
! ?  [ ! . Z# a["ÉB
ZôŸ. ] €I !>]
  ”I“$? > Ihòf >   ?  [ *+ ‚c# 
 #a=.Ü,
  Z
 =) ",  ]    @ !  . 4
4


 i] $
 "

 -? #; 1"  !   +!>]  ×I

159
La méthode GET en revanche limite cette quantité à 240 caractères
160
A en croire un article paru sur precisejava.com la performance diminuerait de façon inversement proportionnelle à la
quantité de donnée véhiculée. Pour plus de détails voir Ravi Kalidindi and Rohini Datla , Best Practices to improve
performance in Servlets, http://www.precisejava.com/javaperf/j2ee/Servlets.htm#Servlets106
161
Servlets, JSP …

©Kamal AOUDA 2005 www.kamalaouda.com Page 77 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Ì   ( . @  Ð C"  ! /?] Ð


F M
#*1 <#P=. G
 Ð# @  d .L9M N 

  ",  &1 
",! . 
^!>]
  Y 
f > ) 
 R
‹ !  =) ! -

 @  %.t”6 @ 
 )*+ iR R#
",
,) ##r9
"$ @  :?]   : ! .."H  I‚j“"#
… 
 .:
cò
 $! 5
 %.t×E
  ò >   ?  F Ÿ#
"H
Ëì (, 5"ÉHÚ  L


 Ð#
Ü  LÐ"  ! )I/k‚ì"? > .C=.Ü,Ð"? L
 
 Ð M?!
. 5 .
  @  N 
 4!
 (=. ] .( N 

  ",  I
Ì
 #< [ 
‡H 5"ÉB
Z[
![ N  Ÿ# Aò >   ?  [   [ ?] ! Kd ##   …*(
 =)
 [
N ! # T!h]
  5r ^b I\j“K , 4 *15 5? -R,
  Z  @  l D",! . 
+"#
R? 5!
v
N  Ÿ# 5:ò >   ?   @  N  _…"  ! 5[ @  "$ @  "  !  T ! Ê"?"?  @  N ,€



 \  N  Ÿ# @ 
, 
H ,   I
`
 \ ]! 5
Z
 \4"? h .( 5
"$

 @  4!4   ? 91?€1
 ]  ?€;s
`
 # ! / , f?
 
Z …!#"? @  [ N  !  =) ! K

 @  a ,  a!
 F


/ .H=# #

…

! #; 1"  !   +!>] 
×I
`
 [


 [?!    [ i*(
 =)
 :
 :.
 *+! i#"? @  N    [?? p, 5
"ÉH
 


+  *+ *( #-]
 ] 4\!>] 
”I

Figure 33: Gestion des sessions par le biais du mécanisme intégré à l’objet HttpSession 164

â‚ 5S"? 


! @  N l=)
/ 9Ð*+   #LP, 5"ÉB
ZLC"? l


 G  l Ÿ# 5
ò >   ?  # 
 !? ‚ / 5   /a [*+ *( #/  
 
 a
 N 

  ",   œ =h=#
"H .? œ9
  ?!  4 
 +",? 5 
",*4*+  ;*(! ##  +=) Z
#4Î I
­
162
Cet identifiant est attribué par le biais d’un cookie ou de la réécriture d’URL
163
Le conteneur crée un nouvel objet pour chaque session
164
Source: inspiré d’un schéma du livre Budi Kurniawan, Java for the Web with Servlets, JSP, and EJB, A Developer's
Guide to J2EE Solutions, New Riders Publishing, April 12, 2002, 0-7357-1195-X pages 976

©Kamal AOUDA 2005 www.kamalaouda.com Page 78 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
  
" =) ",  rb!0eeÐ
N  =>=)#R9¡"?cŸ.
( "
D*( _ D
Ô
  =.
 4 R 5   RS 
D
*+ *( #a"?"

:Ê  / Ÿ# 5Œò h   ?  …*- a   .
"$

 @   /
") 5 " ç) ??
 )*+ > .? N ‡Ÿ)Z
  
.
Z# ?  I
JK?=) Z
#‚ /",! .  • =.Ü, 9a  *1 .‚ F*1
#N  Ÿ# 5ò h   ?  "#
 

 N 

  ",  I
œ 5"ÉH!
 *+? œ  4" %.t”o
;  + Ÿ# 5šò >   ?  ; ",!>] f /# , .  

] 
.D
l Q
!P
P


 DL N 

  ",  I Ì ] 
"D", h .l .
"$

 @  C Ê=.! &
"? 
! ”&?N  h .#+9 
 4Z*+? 5  -\ .*1\;# !!I
 
 #a 
#
/]
  ; Ÿ# 5/ò >   ?    =)  @  a ",! . 

  ?!a   #


q T*+ *( #q . @   :"  ! ‡#d .…N  ! ..
Z ‡ ] 
"[ c  .IJ‡ > .#  "H  [
 ”&
 
*( 
&M .
 Y",*4! .|  ",
 N !    ? #  
X  
y 5 
 X 
=. "H  
 *+! lZ c— N 

  ",  I P€ *1
 Œ :Ô!    !—  W Ÿ# 5
v
ò >   ?  Q /H 5"ÉBa  S5  "  SN 
Q
 /N "$ )&; =.? / ]
 ./
L #.
."?",
#" p 
K
#
[F]
 I• c :
 p)  @  [[!F]
 K ]! @  : …"  !
 N  f  .*14
?!•9F /", ?!I Ì  N 

!   4
#
 4;]
 ",
5 . +?! f
 
5 #
 M 
T  M  . ÐN  ! .)*+    M=)  " <#U#"? @  N    ì",! ) 
 ! c
#?=.#"?*+?  !
" ) . IJ‡  )& F
 
> 
 1",! .  .4 > #) 
 ! ϥ =.?

 
#
]   . Î
2[*1 
! .  ?€ Ÿ# >ïò >   ?  *( "? h ./
#
[ !
d #/!? *(
 =)
/9a5  f",
/F N 

  ",  ",*4*+a ] .;
 
5  17I

Figure 34: Impact de la taille d’un objet HttpSession sur le débit du Websphere Application Server166

165
Rappelons que les objets HttpSession sont des Hastables qui stockent les données dans un vecteur (clef, valeur).
166
Source : Harvey W. Gunther, WebSphere Application Server, Development Best Practices for Performance and
Scalability, IBM White Paper, September 7, 2000

©Kamal AOUDA 2005 www.kamalaouda.com Page 79 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

“j ! . Z#9 N 

  ",   
 4=. "B  
  . @ 
 *+ 1"  ! 1!; ",
 
"H .•~) 
Z
• `
! 5ƒK9[ /=) F"$ @  ]    .I N  Ÿ#
"H  =‚  5! fN  ,]  K N  Ÿ# Kò >   ?   @ 
 
 
. 4 h ) 
 4< + 1  >]  "?4  1
",
 €
 I J‡ > .( .
"$

 @    # !? .+ 5? .=. 
 a  *1 . /
") . /
!"? K€! #. …  ]
# h=.*( "? Ì  _  =.b? ]  ªÈõ
v
 . %.tׁØI

«¬®­ ¯ ° ±Œ²±€³,±K´¶µF·}·¸±K¹ º»‹° µ¶¼#µ3½K¾|¿ ±X»j¾[½À³,±AÁk²l±ºFµ ¹ ¾ ³,±F» ° ° ȱÄÀÅ#±K´X¾¯ ¾N¾ µ+ÆÀµ °ÈÇ ±ÉyÊ#Ê˃ÆA±FÆÀÆÀ¯ µK¹

·Ì» ¹F»A¼#±F·¸±F¹3¾I¿ µF³Ãµj½À³y²l±KÍÆÀ¯ ¾ ±KÎÐÏ#»3ºF° ÃKÁз}µKÆF¾|½AÆA±X³0Æz¹±DÇ ±X³Ñ¾ µ3½X´¶­‹¾ ­ ±€° µ¶¼Sµj½K¾ Í3½K¾ ¾ µK¹KÆzµK¹Œ²l±KÍ

ÆÀ¯ ¾ ±Fƾ ­ ±ÒÃQǯ ÆÀ¯ ¾ Î|Ó̵KÆF¾Ð½AÆA±X³,ÆÔ½AÆF¾ ·}µ(Ç ±‹¾ µÕ¾ ­ ±¹ ±Äj¾²±FÍ+ÆÀ¯ ¾ ±Œ²#¯ ¾ ­Kµ3½ ¾¿ µF³È·Ì»° ° Ë° µÀ¼K¼S¯ ¹¶¼‚µ3½K¾Iµ ¿

õ3½À³0ÆAÎÐÏlµXÁ}²#­K¯ ° ±¯ ¾#Åj³0µ(ǯ º ±KÆ)ÆÀµF·¸±€Í ±F¹ ±K¿ ¯ ¾ ÆÁž¾ ­ ±° µ¶¼#µj½K¾I¿p½A¹ ´X¾ ¯ µK¹¯ Æ)µK¹ ° Ã+»)Åj»K³¾Iµ ¿I» ¹µ(Ç ±X³È»° °

ÉyÊSÊËrÆA±FÆÀÆÀ¯ µK¹k·Ì»¹F»À¼l±X·¸±K¹j¾KÆF¾ ³È»j¾ ±¼FÃ3ÎjÖ ¿Aõ3½À³²l±K͸»AÅKÅ#° ¯ ´»j¾ ¯ µK¹y­F»¹ ºF° ±FÆÑÆA±F¹KÆÀ¯ ¾ ¯ÈÇ ±kºF»S¾ »'×pÆF½X´¶­¸» Æ

¿ ¯ ¹F»¹ ´¶¯ »°S¯ ¹¿ µF³È·Ì»S¾ ¯ µ ¹ØÑ» ¹ ºz·Ì»¶ÃrÍ ±-»´À´À±FÆÀÆA±Kº)¿ ³0µF·Ù»ÆA­F»K³,±Kº‹²#µF³ÈÚAÆF¾ »j¾ ¯ µK¹)µF³ÐÚA¯ µKƶڶÁ|´¶µK¹KÆÀ¯ ºK±X³Ð»

° µ¶¼#µ3½K¾ ¿p½X¹ ´X¾ ¯ µK¹x¾ µyÍ ±}»k³,±KÛ3½A¯ ³,±X·k±F¹3¾ Î3ÜKµ¶¼ ¼S¯ ¹¶¼-µj½K¾¶Åj³,±DÇ8±F¹3¾ ÆÑÆF½AÍKÆA±KÛ3½X±F¹3¾j½AÆA±X³0ÆÌ¿ ³0µF·QµKÍ3¾ » ¯ ¹ ¯ ¹À¼'»

Åj³,±Dǯ µ3½AÆfǯ ÆÀ¯ ¾ µF³À ÆÕ¯ ¹ ¿ µF³È·Ì»S¾ ¯ µK¹Tǯ »Œ» ¹b±Ä ¯ ÆF¾ ¯ ¹À¼fÉyÊSÊ˄ÆA±FÆÀÆÀ¯ µK¹ ÎÑÝI»j¾ ½À³0» ° ° ÃKÁy¾ ­ ±FÆA±†»ÀÅKÅ#° ¯ ´»j¾ ¯ µK¹KÆ

¼#±F¹ ±X³0» ° ° ÀÆF½ÅKÅ#µF³¾l»bÇ ±X³ ÀÆÀ­KµF³¾DÉyÊSÊ˂ÆA±FÆÀÆÀ¯ µK¹+¾ ¯ ·¸±Kµ3½K¾D¯ ¹3¾ ±X³ÒÇ/» °#» ¹ º)·}»¶Ã¿ µF³,´À±)»r° µ¶¼Sµ3½ ¾l»¿^¾ ±X³

´¶µF·žÅS° ±¾ ¯ ¹¶¼x´À±X³¾ »¯ ¹y¾ » ƶÚAÆAÎ8Þ

4.2.1.3 La validation des données au niveau de la couche de présentation


`
 ( ]  
 
.(
 ] ! ??] ? ]  œ  (


 1#! Z
 (
4  \=.*1
  # 
  
"H .
 @   F? •
 [:
 ]  […"  ! @  N :
 ]  [[!>] 
”IJK /]  
  
 ?] ! ‡d ##c",*1
 *+! 5 # c# 

? . /  
*1*+? K :",?=) !    . …
 N  Z
) $
*+QL]  
  &4 C# ??
."? C
", ?? # C
[ N  *1
 *+! .F /ì 
",?=) Z
.  -1 .’!!    !  1"  ! ”I

€ *1
  f N  Ÿ#
"H  =pr N  Z
) $
*+c]     : , p…] ) =)  @  N 
q

*+ .
v
," 5 .RD"#  4#    "H .¡ D, ) "H 
#SÑ- , .4JK.D † j Ì &i !. -9P
#*1 <#‹]
 
 ).? ‚c N  *1
 *+? 5[
 ]  /!>]  ”I•J‡  Z
) $
*+a , ‚=>=# ‡


  " Ifk

 V V
  š=)# @ ! 5V9X
î!>]  r H 5! g ?] ? g N 

 !R 
!   *+! r
Z*+! .c Ð .*1LÚ# !Ú #Üìc ì"  ! ”I/efì#] "$ M 1 N  Ÿ#
"H  =a
 N  Z
) $
*+… , F] ) =)  @  : :

*+ .…: ",5 .[…"#  K€
 , .[
a 
![



 [r ‹ @  T , @  N  f N ‹
c . 

! r^  .! .
A
r T",5 .&?
 *1
 *+! 5  S4
 ]  ((!>] 
]
 !   "H! 5
)
 I

167
Stacy Joines,Ruth Willenborg, Ken Hygh, Performance Analysis for Java™ Web Sites, Addison Wesley, September
10, 2002, 0-201-84454-0, pages 464

©Kamal AOUDA 2005 www.kamalaouda.com Page 80 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

8 +! #
.
 <*+
? • ;",."H .<#+=.5 .*+!  , ) 
 1\’i4 , ", 
H -!") ! 5
‡
"  ! 5g 
   @   ¡ S ]  
 
 N S "
 D=.)*+lS",? .Á I Ì   Ê  S"   !
 ?"H  ]  N  ! .)
# 5  FFb! ]
!") ! Ka † !") ! K 
‡?c
.’!A … ]  
 

 , 
  Z 4N  *1
 *+? .
(?€
 <*+;*+
",
 *++(]  
  (4
 ]  -(!>]  ×I

 ]
 .‡  ;]a •]
 ! K 
!    ! ##… … .’?  N 

  ",  &• F ] 
 
‡ !
v
5 Ÿ.
.c ! #p
a?c",
: c , #) "H  …
‡] ) =) p b! ]
!"!) ! Ê † !") ,
?! "H  ] + 
 
H .  "  ! #%.t”„uIk‚  N  =>=) *( # ] &
 


 ;]  
  ;
 ]  
V!>] 
‹ V=#. @  N "?"., #Y ô .*1š
Y# !U r ï",!*1*(  V 
# ??
#"? 
I
ò 
    *+! ”&  ;!") ? 5  ‚  *+ ??
Z ;]!  
  ?! œZ  # ; _
*1 @  *+?
‚
9q5  ‡N 
=) "$
 ‡. ??
#"? [> 5
Z
 F",*1*+c"? 
!    ! ʜ #)! 5[~” ? #"?
`
Of
  ƒic",
 [… i*(
   *+? Ê
c …]
 I r
#*1 <#:
 5"$ …=."   .T 
*( ! . "?;4",
*- +  ;  1# 5*1
 4  Z  Z 
  ( 
œ  1 >=.*( "? 
#"? @  N   (=. 
 B9+ \ .  -",*1
 €  -",*1*+s
`
ï.  Zî Ð=) "$
 5ìï# ??
."? !%.t”ˆl
q"$.Zr  ì Z
) $ *( š T  

.*+< # ^-]  
  (
\ ^ Ÿ# 5ib! ]I
` `
N  ! .)
# 5   1=.*4
   [ N e€

# ?    Z
ZI•â‚ 5"? 
! @  F"? 

=.*1
  Ð ?] ? …>=. L!š# ]  c
 Q h=5)*(? .  @  š  L Z
) $
*+ G
]  
  Ð
! P 
a  C "  G F  PB’\ ."!$C~.  5 5? a . @  M  l]  
  

"  "$ !  ( . .  !\
+  \  *+? 5\N 
1"$,' +4",."B .<# ,ƒŽI

4?G5 )&\ l?€
 <*+¡

."$ l",?*4*(P*( ‹P# ??
#"? R#"? @  P 
v
! >] 
g . .Œ  ï?") ! 5Y"  ! l  " ï
W  Ub ",*1*+X±",
X, 5  @  I
v
JK! . #*+! 9  
#*1 <#4

.
"$   4!"!) ! -]  
  1 N  , 
\",!, )
 ( 5! . 

 <
"? c9R>  i…=) "$
 i # ?? #"? 
Ipj“f H ^#?] _ Tr
.’!i!?  5Á @  N  f ,
 .
"H . ; 4!>] 
 ’I

â Ocs•j“  , ‚ *1> 5! œ . @  F [*1 €!  #/F


   
. Z

Z ;/?") ! 5;

 
Ê
*+d*+;
Z1 , 
 1",!!4;. !  ?!*+! ;; N  ! .)
# >  (4
 ]  (1 .’!”I
è(G",H 5 .C ",#Ð
P=.  @  Ð  G  ? SC >=.)*("?C   G  ? S
*( ! . "?; (]?  ^ 5 Ÿ.
5\; ×I

168
Cette information est incluse par le browser dans l’entête du paquet http envoyé au serveur.
169
Formatés souvent en XML

©Kamal AOUDA 2005 www.kamalaouda.com Page 81 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

{"?/9F"?/  *1*+a !=.! f ?? _ f #.?] 


/? !  ",*1
.*1 ;ôZ
.
! œ9
 N   
) @  … c >=.)*("?… N  , K
!
 *+! 
 F =>=. #F .*1…# !…*( 
? ?
 4=>=. #+4",Ï! >
I

4.2.2 Anti-patterns et patterns de la couche de contrôle


k g N #"$
 .
"H 
#lÑ-

0S D",! .Á 
ʟ. l
D.Á D"$)
 <#D! ##¡ ¡", "$ R
‚

# !! 5  D ; N !*4
 ¡ g",*1
?! 5 @  Ê ", 
 ! ; G 
Z @  ¡N  =>=. # ‹
 N 

  ",  I‡JÊN  , \
r 
??
ZT
  Z g-  @  œ
 ] ! A .  . 5? 5 q  q# @  d . 
 ]! cN d ##š . .  
I/‚N    , q*( ",Üô  ! c] 
 q
 š] ) 5
 V?
#"?Ú
",Z ,  I ",? #1 H?4   Z;#   
"B .  4 > .)( •  4*+   
# 1
.  @   (
v
 N  , ) &g q ! l",! #) 
 S=h=) ","?*+? ¡9n N *+   .  X È >=5)*( "? ±
 N 

  ",  +",*1*+ !!+ (] ).^
+ ;# H 541"? > .+!
"B  I

4.2.2.1 Quel objet utiliser pour implémenter le contrôleur ?


8    !
 S!>]
  ; + À=)  ## l  *1
 *+! . P",? .Á 
; H 
P¡"$ €

.
"$
 
Z @  #"? @  c",! . 
A c"!#
 @  N 
 …!
  , 5 "?…—"? > .…!>]
 

Z # 5! 5 4  +# @  d . (? .? . i] .+ N 

  ",  I J‡   ?ç”"H?! )&-=. )&? . .
 
‡ / #$
# 

F"!#
 9 N  ! . ) 
‡c
."? , / > #) 
 …9q c!>]
  )I‚j“c#  
 .… 

",*1  / 
H 5!     / 
p  a# ,?
#"?  ‚ a >=.)*("? / 
  
# /9c"?   
 ^ .
"$
 
Z  (J‡Š(j>I
`
 +b 
 
5 f ?! @   4, ."H  4 4!>]
  5
IJK*4*(  N  ]
v
€

  @  [
a 5  a0 …",! . 
p  /",?]5  )&•F)) <#:
 &•!>]
  5 ]
 

*+
",
  *+…a .    IfJ‡ q  [#q*( [ >=.)*(? .  @    !>]
  5F K
 "
*(  @   =)
 
f"?"
  a.Á /",! .Á 
×IÑ(d*+", "   
  /eb
O @ 

?! ‡ #< aZ

*(
[:# ??
#"?  IKkT
 :  : T ?] ! 
[d #:
  a9r5  
N 

.’!]
 F 
. 5
", $! > ~#+=. f N  ?]",  ; eb
O…!;=. ]
   
. 5",  
H_
 "$
.  Ð",*1*+î‡Ñ;j çŽjhj è ì ",#š C!>]
 "? Qô*+ ??
Z š
H_
 "$
. 
v
",*1*+(b Ñ(fƒ'I

4.2.2.2 Stratégies pour la gestion du cache


#"? @  N  p , #
" 
  
 #l¡ 5! . ¡  ¡# @  d . R! .? . r] .¡ N 

  ",  &Π
v
," ! .Á 
 H 
\ ##< ++*1
 "?*+! 
 *1  *+! . 1Z H  (("H"$ I

©Kamal AOUDA 2005 www.kamalaouda.com Page 82 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

fn
   Ç ! .)*+   #È
X N #"$
 .
"H  #Π
 )*+ DÇ",
H) #.Ô  Y Ÿ# 5
=)# @  *1*+? ?    ! +  -"  ! 5\  1",.
"H .<. 
 \4*( ]    +  
.-  5 >
I
`
/.Á  N 
;",? .Á 
f  !  *1 ./
(9 N  !  =) ",  1 ( Ÿ# 5;?]! d #*1 
l","$ I4j“i 
i#]
 ! ; Z
 *+! 1L*+ h #S  ©?]
#L
 S, . . Z P=>=) ","?L

. =)5,×"$
 ”&\  *+! .    # *+ *( #4","$ ( *(
 <#+9s
e]
 .  =)
 . ^;*+ *- #%#”‚~*+*(>_4  ÉB?ƒ
• `
 *1 . 4Z  .  ( _
!*1 @  4 (
Z 
I
• `
 *1 .  ^"?"?< ^9   !44


 
I
` •
 -, #. . Z  (",,] !  
    -. =.,×"$
 ?!*(! 4","$  #
!? 
• N
"$Z1
*+ ??
Z …B_
 "$
.  c! #‹ T",! #.Á 
i ^ T?
#"?q …


 :*1 ! c","$ I
k‚a"?q*(
< q ",! .Á 
p?] q ) 
 @  *+! ‡ …*+ ,?
Z F9T :?
#"?q

] ) =)  @    \ Ÿ# 5(*1 -+",
"$   N ! 
\"$Z 4N 5 )I
†  @  …  /*+ ??
Z ?] _ ?? H_
"$
.  / a",! #.Á 
K# , .Fa , 5 "?4Ÿ) @ ! 9
"? @  g r?
#"?g 
‚# I Ì *- cg ‹ 
œ > ) 
 -
T
."? ,c  r"? > .
 .  ¿ ? Q
  @  Q ¿",! #.Á 
C L",!
*1 Q Ô=. "B  
 *+! S 5 5T
`
 N 

  ",  I N  .  l 

 !l? i S?
#"! @ 
Ê
 4?") =) 
 G5  ll! 
# ??
#"? !%#'%i
A# .…[",? .Á 
p*+d*+…   Ÿ# 5a*1 F[",
"$ N ! p

"$Z 4N 5 ”I
 
c*+   
# F >=.)*( "?  &"!N  , ‡ [?
#", @ 

 ‚ ] 5  Ê [ ,    [ . @  
v `
 N 5   Ÿ# 5"$Z
I N  ?] .  //![ [",*1*1

 ",  /?
 
Z&=h=# )&• 
# ! g - *1 
 l  g)  @   Tl
 ",
ZRl
 ]  ‹g",! .Á 
×I^k‚g D!
"H  
I 0I.3I.3l+ N  ]+ +
1 *1
 *+! ."? *( 41",*1*1

 ",  1 ?] .! 41
 ]  
­
 …", "$ ac # !? 5  [#"? @  N   N  , ‡
 

5 . …‡  F
.’!.
IJ‡ 
! )&
1
 ]  (; ;", "$ +
1",! #.Á    _(+ 5
"$

 @  *+! 
   
.+ ?  
   . 
I
`
N  ] < *+!  N Ì j b
Ñ(q   *+ ??
Z 4) ]   4?   =)  F.Á \Ÿ. ‚  
v
*+ ??
Z ;
H_
"$
.  1
 Z ,  ","$ IŠ\7 Â"?/9F"? *+ ??
Z  ",! .Á 

 , [€ *1! . MN 
 V>  ìì?š"$.ZìÐ #5 ] 4 1Ÿ.
 ìN 
š*+   
a 5?€Ð
  
 
   . I

170
Contrairement à une croyance largement répandue le garbage collector ne prévient pas toujours les fuites de
mémoire.
171
Mémoire, processeur, temps de réponse …

©Kamal AOUDA 2005 www.kamalaouda.com Page 83 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

8 š M",*1*+ì
!Ð
Ð!>] 
[V?]    M š",! .Á 
[N  !"! a

#< CN 

‡
*+ ??
Z¡) ] l  RRN 
R!>] 
4P*+ ,?
Z rb
Ñ( @ 
‡
 ] ! ; P  =) n9
"$ @  š=.  @  U N 5 … M Ÿ# 5Ú*1 ìš"H"$ ô"$ZU~. 
?") !›”


   $ƒŽI[k< 
#
"?!  /a"? > .…!  =) "H  a a",! .Á 
K*+ 94Ÿ.
‡  


 ",!>]
 
 
","$ 4-=.Ü,-9 #=) .  -"$Z*+! 5^N 5 5(#
"?*1*+?  
>] 
!(~#"B=”IH=) Z
#1Î
7 ƒŽI

172
Figure 35: Rôle joué par les messages asynchrones dans la gestion du cache

k‚l  R

  ",  gb!0eeÚ P, . . Z SSZ
,  ¡P","$ P , 1??] ! ;",

S9
 N  ! . ) 
[ G=)  # M~.?>]
  =)  .5?ƒ @ 
4",*4*(VM N  ]G]
Ð
 M ô5  ì0
 ! .#"?! .?  5! . …  [. @  d . ›”# ! aa*(! ›# ][",! #.Á 
h›Êq …]
 Ief
*(! f   # @  d .  5 >!  
• 4


 4 ͟.9F*1 ! 1 ","$ ?! f ! .#"?? .
  
 ~.?ƒÊ=)  #~.?ƒ @ 
  F*1 d
"$ ~)! >ƒAN )) ] Ÿ) @  N [",! .Á 
A~.!h]
  5ƒ'I‚kc"? > .a=.Ü,
`
"? S# @  d . l#
Ü, ] ! 4 S# ! l
 S.
 *+! )I  l# @  d . R ,  
 D?€



 [c
 "?
 / [ c","$ [?! Ê#  _
 ] .a c",? .Á 
p*- Fa ]  
# ! _(=>=# #! . ^?! 9  
 5
*1 ! \("H"$ 1",*1*+; ;*(! ##  +=) Z
#4Î
÷I

â Ocs /", ;
"$ ? ”&  =)  # @ 
Z<#F /","$
 œd ##F
 "?  # < 1"? 
 @ 
Z<#F 
Ê
!
"
) . D -*1 d
"$ ^ r  .?
  TT? 5) !
 N "?"?  \9g 


 
",?=) !     
I

172
Adaptation d’un digramme de séquence publié dans J2EE Design Patterns, William Crawford, Jonathan Kaplan,
O'Reilly, September 2003, ISBN: 0-596-00427-3, pages 368

©Kamal AOUDA 2005 www.kamalaouda.com Page 84 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Figure 36: Gestion de cache au moyen d’un Servlet Filter173

`
  Ÿ# 5?! *1 /","$ F
 c*+ *( #]
 ] F/!>] 
”&  ‚?  @  F
‚
  ",#D
R P*+ *( .¡","$ D¡
.’!×IiJp$"
g¡"? R#
" 
 ! 5R
# ! ! .S  
 ]! 5
Z -   +  ",?] 
 ! 5- 
 *+ # \" ç) ?,1s

ª(¦¸ ¤#©Æ
¸ Æ ©¥¹/²!©¤>Æ ©¹
¤Ö"?[#
" 
 ! ‚ H .
 FN "?"?< /*(   … *+ fFH 5"ÉH
ê
@  N 
  @ !  . a  *1 .
/
/


 
I v   @  /"? > .F*+ *( #/? •Z #
F5  
   *+!
 H=.! œ!    ! + Z
) )$
*+  @ 
H   *1  ! œ~>=)  $!ƒ.
 *+! œ  +


 + 
 >=)   4
@ 
•*+ > .? Ê…","$ :",   F _! A
 … #< /=.5 5q
.
   . cN d #c*-
 …  

."$   (# @  d . !%#ž I )*1H"? \ Z
) $ *+ ^1! " .•s
v
© £
²,: ¬ ߤ#© æ¹ ©«!¬¨ Å ²!© Õ
¥ à ß Ö",*4*+?F*Ú N   @  a"? f Z
) $
*+F   *1  
• ß Ù ß ÙNá
","$   -


 4;.
"?*1*+? *(
 
I k‚4  4
.
Z.*1*+ 4 H , *1 (
©?]
#œ 
  (N 
 /  , . @ 
 
 "?; 
#*1 œ.Z; 5! .;


?]   *+!
*(
I Ì a=)
A Ê9r*+  
#:T N )) ]
: c# @  d . 
&  a


 c  c*( 
*(
 1?!  
#" 
,!
 Ÿ) @ " ! 9/"? @  N    4? ! • =) 
  ] *+! •   *1 
 1
   , .I

173
Adaptation d’un digramme de séquence publié dans J2EE Design Patterns, William Crawford, Jonathan Kaplan,
O'Reilly, September 2003, ISBN: 0-596-00427-3, pages 368
174
Par exemple les données relatives aux produits vedettes.

©Kamal AOUDA 2005 www.kamalaouda.com Page 85 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

߸ ¤.²,¬ «ä¸ß¸ ¤.²,¬ ¹!¬xà ß ß Öp ##< R.#*+! 1?    ! ¡"? ( Z
) $ *+¡   *1  RR","$ 
• ë Ö ë Ö¸á
 N  *+!   
 \ " \    , .;~)
#*1 ! ## & 
#*1 ?5  ƒŽI
£
²,¬(¸ «Ñ
ä ߸ ¤.²,¬ ¹!¬kà ß ÖA ‹)
 <#r


‹͟.! .
‹r","$ ‹ H \   *1 
g
• ß Ö ß
ë Ö}á

#*1 ”I

â Ocs"? > .S  , .S N  , 1


R  *1 5  ] I  
4",
,) ##S  r! # r Z
) $
*+ R!
Ê
v
#
",*4*(
(  
"H  .4 \?€4  ]
# ^  
 ]! >1s
k  Sõ ?! 
&iõPJK"$
 Z&(èH!    _&1{ ., /e  lb 
 G02
23 &1j Oâps3Hç
‡
7
÷
7
ù 0
ç”7
Î
÷ ç7& 
Z \Î3,x
Ñ4 "$4‚
  ]
 "$LMè(  ] F >!"$ 
"É!&-õQJK"$
 ZÐÚ   ",  &
Ì 
 ?\õ   _& k
"?*4 0•3&!02
23&2 ç)023Hç”÷3,7 ‘
2 ç”Î& 
Z  2
2
­
¸ ²?æ¹ ©¥¹
¤¥¹;²!©¤>Æ ©¹
¤×Ö",#
" 
 ! f *+  , >"ÉH
 4


  @   F*+ *( #
ú
]
 ]  *( \"? 1!-=. - ) *+? \ .*1^;# !I

ª(¦¸ ¤#©F·,£·Ä ©/¥¹´


¤.¦ې²!©¤Ö",*1# /?€? #  "?a#
" 
 ! œ =h=)#F
 F
 "," .
ê
[, 5"ÉB
Z… Ê :*+   
 .*1/c# !c*- a 
# !! .[?  F  ",?] 
 ! 5
@  4 ]!4 ͟.9 ") 549 ;=) ; !
"H   ­ I 0I.3 I.3Iâ‚-] .+
  F>  7
",*1*+? (*(
 =) + N ! .d .‹ r @   5r$! > g
\.

 \g
.’!^D*+ > #g
","$  
  !>  41 + 5 5  . 4N 
  
Z-õI

g © ª(£¤.æ¹ © 1ÖÖ1
/", ,) ##Ð  l Ÿ# 5 @ 
- ?] ! d #Q*1 SG","$ L
G
 


  ",  (1",*1*+#"?4  
"H .
 @  &   =.? !;.#4?€-!
"B  \0I 0I Î4 ÎI.3I

g © ª(£¤.æ¹ © i•Ö  P




 C ?] ! d #Q Z
 *+! F*1 ! GL","$ C
PN ! # 
#
" 
 ! 5P",*4*+M  P"H! . 
. &;  L.? .
.lL ",#M  S!>]  5L
. €?_I1J‡ 
#
" 
 ! 5/ N ! 
 . / . . /#"? @  N     ?!!  F",
#F"?  ,?~#"B=×I!
"B  
3 I Î ƒ'I

4.2.2.3 Compression des paquets http au niveau des filtres


`
P",*1
# ?  ¡ , 
¡ .
"$

 @  S",*1*1
 *+! ?    !
G
# 
 #G l 5   l 



 R?] _
 gD"  ! ”I(ef  G )*+ 4G  ‹ . 5 .
 ¡.
 *+! 4   
# ! ô*( ì  ôZ#U
ì .*1Mî# !!V 


 *+! 5 #V > #) 

 V?€
 Z
) $
*+ ^1",*1 # ,  ,›#
",*1 # ?  I

©Kamal AOUDA 2005 www.kamalaouda.com Page 86 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
  @   5$! h ?? œ
/  *1
  +=) "$
 . Ì ‚Jjhj ] 
"
   
.  ! # 

! .  @ 

=."   .!  *+ *+!  
",*1
# ?   %#)ouI !€ *1
 1 
• 4  .1 

 ӄ(
"$
 ",
v v
~ 

 ӄ(
"$
 ", I ",*(ƒ N !    ?  glŠj S )*1 rl# 
 #R¡x I Îm˜ R 5   
v v ­
) Z  4  
Z4N ","   I

Tableau 16: Compression de la taille de la page d’accueil du site http://www.popularmechanics.com/

Ì ] ! fF",*1 # ?!K   




 / =)  #
 f _!K N ! .d . / @   5/$! h F#
Ü

Ê] ) =) A f c=.)*( p i N  Z
) $
*+",*4
# ?  q!    ! [?! Ê  
5 . :^ 

.’!×I

GET /products/firefox/start/ HTTP/1.1


Host: www.mozilla.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7)
Gecko/20040614 Firefox/0.9
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/pla
in;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Content-Encoding: gzip

Keep-Alive: 300
Connection: keep-alive

k T N ! .d .‹" ç) ? q ‹"$*1rJK! .! >ç'ef "H
 ZD  @   @  D R
.’!(~”Ñ\ ö    
ƒ
‚
 

5 .F  =.)*( œŠ‚j Ief1=. •

 F3,ù
ù
xF a
 
5 • 
.’!.1! • . 
 . 1 
v
=. "H  
  . G# @ 
 ! G
/ 

5 .a Ð",*1
# ?  G L @   >G$! > P ] 
"l 
`
 Z
) $
*+ ÐM
*( î


  "Ð",*1*+VŠj %#)tuI  š#
"$ #"$   @  ôÐ ]
v
=>=#
"B 
  4! •"?
! f# ]  "?5 5      ",*1  
   . 1! #Šj  Ñ4 ".
?=5
` v
j“! .)  Êe€

 #×I : !a /",
 ?? "? ~)øf’\  
Z:O
! ƒÊ:Ñ4 ".
? => ",?  !
 
 \*1
  \ >  \91"?4  Ÿ# )I $! h s ›>›#

> ”I *1 ".
?=5 )I ",*^›”É?H›Î 0•3,‘ 0 0

175
Source: Speed Up Your Site: Web Site Optimization, New Riders Publishing, January 17, 2003, ISBN: 0-7357-1324-3
176
GZIP par exemple

©Kamal AOUDA 2005 www.kamalaouda.com Page 87 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

4.2.2.4 Pooling des ressources


8 [
 , ‡
a!*1
 ac# ??
#"? F# !    ?
  
Ij“ )*+ ‚c5 >
Z  Ÿ# 5
‡
 ͟.9q"#
 [! #T
    .c# @  d . aT*(
 <#c9q ]
 .i  [",Ï! 5c  a9T?]    
 , 5 "   
I k‚+  ^

  ",  ^b!0ee4# #5?]    +
 \9 
   
5+
 ]  ?€;s
p¹a«
¸ Æ © £ ¹¥© ² ²!©¤>Æ
¨ © ¬5² ֝
 !>]
  f
??" [
 $
# 
F9a"$ @  [# @  d .a?]   *+!
#
Ü q*( a"? T [] ? p
F # @  N   :"#
c! 5! ‡[ $
# 

 @  N  _[:q# @  d . 
! .? . 
I 
f /
4 

 !f  ;# ??
#"? +4!>] 
”& ",! . 
•"!.
/
*1
#
v
  *1 . 14 $
# 

(   4
 "?1
4
;
 I #"? @   *1
#1 +# @ d . (! #.! . 
v
 ,  .Z*+! 4 
 ) 
19G"? 
p g $ # 

l
 "? R
l L
 &- p
 *+ > ##L  
# @  d . q€ "? ? 5 # :
r
 T=)  ‹N  > .! .[Ÿ) @ " ! 9R"? @  N 
g?]  q $
# 
g?
   # I Ì  N  ?  q… . 5*+! pN 
 ‹# @  d .‹ : $
# 
 @ 
 
•r  . q
,  Z ‹ N  , ^

 )
 )Ij“! H Z
. ;
1 /
! , •#  
    ! /
 @  N 
 /?]   # @  d ./

 ?!;N 
!>]
 ×I
Figure 37: Pool de threads maintenu par un serveur d’application177

p¹¡«
¸ Æ © £ ¹g¥© ²g´£
²!© ²r¥©D¥
¦«
« Â
© ² Ö^ ¡",
 €
 g9P
 S !ÀR


 ‹ , 4
 
 .  Q ##< Q",Ï? .!ìš*+ *( #š [š 5"? ?!
”I Ì  N  , 5[ L $
# 

M

 ]  
 
 G ! !
g!G *+ h #ll"# 1! 5? 4S",
 €
 ! @  N  K_DS
# @  d . ! #.! . 
I•k[ …*+d*+[*(
 <#&  c ! 
/5 5
ZK
 ?
 F",
 €
 
! #4 5? . 1  4# @  d . - )  @  ;;",
*1 •  - #. .*+? 51.  <  + •  -"?"?< 
", "
)#?   \9  
!+4


 
I

177
Source : Adaptation d’une figure publiée dans: Threading/queuing "funnel." From IBM Software Group Services
Performance Workshop presented by Stacy Joines, 2001, Hursley, U.K. © IBM Corp. 2001

©Kamal AOUDA 2005 www.kamalaouda.com Page 88 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

JK*1*+… [*(! ##… F 


Z.*4*+Fa" 
?!F… /=) Z
#aÎ
x… [JK
 
"H   
# Z.
 
` v

S*1
#G  *1 . ll",
 €
 g ͟.9P"#

 ¡~#JK
 
"H  j“*1
 ƒ'I . @  N 
 G?]   
# @  d .F)) ] … [JK
 
"H   


   … c*+ $
F" @ 
 #j *1
 ~.ƒ @ 
 
# 5
) …
 
v
",
 €
 ™
#d .˜9z N *1
  IL8‡ ¿=. Ó Ó #5 .*+! Q– z# @  d 5Ó .*1  w 
JK
 
"H   
!
    F*+ $
/#  
!j“*1
 ~5ƒ
   # /",
 !€
   f *+ > ##
v
91 ?]    (# @  d . ^  # ?    !×I

Figure 38: Diagramme de classe du ConnectionPool178

p¹/«¸ Æ © £ ¹ ¥©F¨ £·,¦¹ ·Ä ©Fª+ ¬¸ ©¤•s9a / =>=# # "?
 1, 5 .!=)
! ?  /  !  1, 5 .  ?
! ?  Ð  C Ð",!>] ! a
PQ


 L .?
  !
 P
C  P Ÿ# 5P
`
! ?  IJ‡ > .F
. ) . ;=."   ./ )*+ *+!  
œ",!>]   
1 
 
I . @  
 Ç",! . 
¡N eb
O–#
Ü, S
 Ô# @  d .&‹  N n
Y9Ç!È? " l Y


 
 .?
  !
 Rl"   @ 
i N G?] _
I #"? @  N    R?!  !  @   
&( i !  

v
# 5 ) a N  *15 . @    M , 5 "?CM N eb
OU
 I1J‡M. ?
 *+! N 

  @  M
.   ]
 . ?€;?  h_  4 ?€*+ ??
Z ) ]   ;*( ;
+?€1, > .=)
?! ?  
  Q#"? @  N   L", !>] ! [ 
? [ M! ?  M  G


 Q .?
  !
 G
"$ @  c"  ! ”I‚ef/=. ”&,[#  
    ?  &
 . !    ?  a , 5 .=)
! ?  c  
 !  =h=#
"B . ;",?=) ! #   . 1  N  ! . Z) . 4 ^


 +~)€ *1
 4 ? +"  ! # ?    !
  
 N "$ #*1
 ,? #4"  ! 5ƒ'I
J‡ a K  N _/c
c# , ) "B   @ ! ?€ h_
 N  Ÿ# 5 @  N a ! K
 "?‚


`

 I [#!    ?
   .  ? ‚
.  @  *+! ‚ !
 ",   @  N   ;
 ] ! ] ) =) ×IJK*1*+
 c*(! #c F=) Z
#[Î
ùc [# ?
#"?c
 ! d .c, .
"H  Z  .  ! a9a 5F  
h_
  rN  Ÿ# 5q]
 P
 D" 
?!S ! .)*+   #l~”{
"H 5>_!ƒ @ 
p *+ 1 R=."B 5) ?  g 
*+ $
 \  (
. ) 5 \1
 I

178
Adaptation d’un diagramme de classe publié à l’adresse: http://www.developer.com/java/other/article.php/626291 ,
Wiebe de Jong, Implement a JDBC Connection Pool via the Object Pool Pattern

©Kamal AOUDA 2005 www.kamalaouda.com Page 89 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Figure 39: Factorisation des ressources d’un pool179

`
 *+ $
Q"#  . ,
#"?~5ƒ[ì M" 
?!š{
"H 5>_Ð *+ /Q"#
a
 ì?]   
š
 , 5 "?F… N  Ÿ# @  N ?
$ .…
 "?‚
 c
 I Ì ]! …?] ‡# !    !"? h .
 , 5 "?   
B
 
  *+  $

validateResource( ) pour la réinitialiser.

4.2.3 Anti-patterns et patterns de la couche d’affaires

4.2.3.1 A propos de la performance des EJB


k -b! ]1 5!  ,  Ÿ# *( - 5? • N  H •
1eb
O‚I!ð•? , • iŸ#4*( 5 @ ( ]!
‚
"$  ‚
i  *+! .- q  !*1
 .) œ  - N !    ?   Tef! .)
) ?qb! ]DO• 
`

q  c

  ",  …b!0ee‚I N Z
 *+! \ i"? :",*1 ?! 5: , p . @  r"?5 5 
#"$
 .
"B .   N $   .! œ 49F    *1
 *+! 5•
!  
.4

  ",   @   @   4? ! f  
",! . ! . (  ;",? .€? .4N !    ?  I8‡1.
> 1Ši5  Š-.
+ H  *+4N    
. @  
  /! #
) ! ! ‡*(!  *+! ‚  ! c
[ [
 N 
…
    Fa  .a8¡

 ! . Z#  4eb
O9  
.i

  ",  
I
Ì   #r]
. &  geb
OG?! \ T",*1
?? 5‹. , .  @ 
f=."   .! ( g 
  *+! \ 


  ",  a
c  …!]
 .
 *+? 5=.> .*+? Ê , ) 
 
I‡j“ a?! p Z
 *+! 

"$ € .
"$
 
Z @  R . @  N q?
$ .‹",, )
 .r T*1 
   .:q T
?!#   
] .F  H_, .<*+ F$ ) . %.„׏^~>]
     
  ",  / ") . /aJK €
"! .
  
Ê

`
Z.
qH_!, .<*+ ƒ'I D#] 5q¡ ¡*+ 
   R , @ ¡  geb
OG?? \ q",*1
?! > ##< 
",*1
 €   @ 
,
"? ?  .! 
 ;*( (N ©?]
#( ##<  @   =)
 ~# 
 " ##< \"!$ <# ƒ'I
`
a", "$ F",*1
 €
 5 / .
"$

 @  BŸ.! .
[  eb
O9… N #"$
 .
"H 
#[Ñ † JS N  , 

?(=>=#   •  4 >=.*( "? - N 

  ",  I
JK*1*+4 N  ]^]
+ 5! ; Z;
"? i ??‚  q ?]",  !q*1
  
  cg 
.*+  $
 []
 R g
. 5", gÊÑ;j ç'j>j è ??
v
€! #d*+*+!    ?! 5 +
 + .*1^;# !I

179
Source: William Crawford, Jonathan Kaplan, J2EE Design Patterns, O'Reilly, September 2003, ISBN: 0-596-00427-3,
368
180
Traduction littérale de legacy systems

©Kamal AOUDA 2005 www.kamalaouda.com Page 90 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

k 
   .  ",*1*+: N  , 5 "   & N "H  ]  ac q
?  ] # a [  

?! Z

*( :r
5"? ?!
^ iT*+ *( .Ipâ‚ 5qi   
. @  g  Teb
OG 
 ?] ! f
1d #€
"? 5 4 

 ",! . 
•!>]
  51",*1*+ ð*(", )Ij“ 4!   ? 
N 
Ô",! . 
G 
" T",*1*+—"? 
qN jhOѽ~>õ 
$ # ƒQŒ˜Ofe Ì •_, .*(
`
~>õ
 
Z ",ƒŽI g   @   5) =) ",  cT"? [," . c H Ê #< [
Z# ,  ] ‹#"? @  N   
] ! F 
.L .

 5l
L
G!
(
 "G*(  $
 @  C ] 
"l "
 M
?  
   . C

",

 
Z1! #  ;","$  @ 
BZ<#   ^b ›h]
  5- "?   @ 
BZ<#   +eb
O‚I Ì *( 
v
N ?]
 ?
ZK N !    ?  N 
/",! . 
Z. 
 .%.„Ž%K",*1*+/b
Oè\R =.! f
" ]  K  

f   ;",! # eb
Oc? 

 ; .)*+ 4/",*1
 €
 .  .
"$

 @   @  N ; .)*+ 
a",Ï! 5/~).
   a ",#…
 /=.  c >=.*( "?… N  , K !
 *(! K
 F =h=. #
4 
  ( .*1^;. ! *( \ Z
 *+? 
 4 =h=. #44",Ï? 5?ƒ'I

ef
.  @  : ! Ê ]  
 p ] 
"…  Fb &  a!>]
  5[   Fb! ]rO• F 5! p"?
v
@ N  !  ]  
 • ] 
";  eb
O‚I/f
  Z49/"?  Ÿ# @   ;=).*(!’)É(œ )? 5  
",!  ! •
(N eb
O[ "? / N  =>=#
"H .
,?/

 ) . 
,?4

  ",
   . ;9/   
.- h_
  
   . 
Ik‚;
 1 +",
;   eb
O: ?] ! N ] #  . *+  
 ;!f.
5 ?€
  ? þN  =>=. # 
IŒj“ }?! n"?> 5  *+? ¿
  "$ €þ .
"$
! 
Z @   

 N  *1
 *+! 5   *1     .;
;  ?]
 .
 *+! 5+=.> .*+! œ , #) 
 *(   
 ?] ! Ê] 
 p…] ) >
  aZ

  5aN .Z *+! Ê
c  a

  ",  a  *1
  [
"?! .  !
 ;~#€ *1
  ;  .",*4*+#"?  
"B .
 @  N 
  Ñ1e…
!   @      N _;
v
 "
   ! ..
"H  (] 
"-
(H_H .<*++N $ ) 5
Z
%.„”6ñƒŽI

J‡ €! . 1  ]


#Ñ-
, .) Zef! .)
) !+b! ]O• ++.,)  ##< + 5  ! ”Ij“?#   *+
  4.Z
*+? 5 @ 
 
  ! •4=. ]  • N  ! . Z.  ; eb
O…?€;

  ",  4   @  
  \    ^
+   @    +  =.!  !]
 . 
?    ?  I

181
Très souvent les licences sont gratuites mais il y a plusieurs coûts cachés liés à la formation, à la maintenance à l’ajout
de modules supplémentaires…
182
Legacy system

©Kamal AOUDA 2005 www.kamalaouda.com Page 91 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Deciding whether EJB is appropriate

Now that we've blown away the FUD (Fear, Uncertainty, and Doubt), here are the real reasons to use EJB
over Java classes:

Your system is built faster and more reliably. EJB components benefit from declarative middleware, such as
instance pooling, transactions, security, container-managed persistence, container-managed relationships,
and data caching. If you used regular Java classes, you'd need to write this middleware yourself over time.
Eventually you might find that you have your own middleware framework. That 'framework' is a fancy word
for building your own home-grown application server. The framework needs to be tested, debugged,
features need to be added. This is a non-trivial task indeed. Can you honestly state that your staff is capable
of building a better application server than the market leaders who specialize in middleware?

It is easier to hire new employees. If you build your own custom framework using Java classes, then
newhires need to be trained on this framework. If your framework is complex, then you can no longer look
for "EJB" on a resume when hiring a developer and expect them to be productive on your system.

You benefit from the best practices the world is building around EJB. You can figure out how to optimize
your system by reading articles on the Internet, or picking up a book on EJB best practices, such as Floyd
Marinescu's "EJB Design Patterns" book. This global knowledge base is not at your disposal with a
proprietary Java class framework.

You can have different user interfaces. You can reuse the same EJB component layer for a thick client as
well as a Servlet/JSP client. With Java classes, you cannot achieve this because Java classes are not
remotely accessible. If you wrapped those Java classes in RMI objects, you'd need to invent your own load-
balancing, instance pooling, and fail-over.

You can work with industry-standard tools to rapidly develop your system. While in the short run you may
think that Java classes are going to make it faster to develop than writing all those files that comprise an
EJB component, in reality there are many tools around that help streamline the EJB development process.
There are command-line tools that generate the files you need, there are IDEs that help you build EJB
components, and there are UML editors that help you generate EJB components from UML diagrams. See
for more.

You can separate your web tier and application server. If you require your business logic to be protected by
a firewall, then you can deploy the web server and application server on separate machines and stick a
firewall in the middle.

And here are the real reasons not to use EJB:

You can't deal with the limitations of EJB. Examples include threading, static variables, and native code.
Most companies can deal with this, because there are good reasons why the restrictions exist. But if (for
example) you need to have a multi-threaded engine, and you can't deal with the EJB paradigm of load-
balancing across single-threaded instances, then EJB is not a good fit for you. EJB is a square peg--don't try
to stick it into a round hole.

You have existing skillsets or investments in a working technology. For example, if your developers are
proficient in CORBA, then great--why not stick with it? As an anecdote, The Middleware Company consulted
with one of our clients who wrote a CORBA application that assisted with mapping the human genome. It
worked well with CORBA, and they had no major complaints, and so we recommended they stick with
CORBA and avoid the EJB hype.

Your application is a big GUI to a database. If you are just a big GUI to a database--heavy on data logic but
no business logic--you could achieve a deployment easily using JSPs with tag libraries connecting to a
database via JDBC.

Your application is simple. If you are prototyping, building a simple system, or developing a one-off
application that will not evolve over time, EJB may be overkill.

Source: Ed Roman, Scott Ambler, Tyler Jewell, Ed Roman, Tyler Jewell, Floyd Marinescu, Mastering Enterprise
JavaBeans (2nd Edition), Wiley, ISBN: 0471417114, pages 672

©Kamal AOUDA 2005 www.kamalaouda.com Page 92 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

4.2.3.2 Gestion des sessions au niveau de la couche d’affaires


`
 ",! .  N eb
Oc ;Z
<#
1  -, 5 .=)
,! ?     ( *+d*+*-
 <# @    

`
, 5 .  ?M! ?  ô  !
I  M, 5 .!=)
  M?! c   MÚ"  ! c 5! : c? 
`
 Z .*1 @  /?/! ?   , œ"B  ] I F*( !   ;


 ;a ! ?  *(

 …‹# ,?
#"?  @  r  …, 5 .  ?  !c i  *1 .‹  
?  
   . …r# !    ?  :9
. ] .+  (
 (~#"B=”I!! "H #  I 0I 0I ƒ'I
­ ­
#"? @  W  V, 5 .  ?V! ?  Y  V?! T ô",*1
?! 5U.
!, . 
&…"?5 5 
v
 ]  
 
. ! ‚
) / N $!
 [  /!    !K
Z #K   


 ;  ! ?  
  : i
 "? [ Ÿ# 5:ò >   ?   @  Ta ]…  [
c q?
"H   I 0I.3 I 0I
­

‚ ##F> 4 ?

.?];"? h . .
"$
  @  F#"? @  N   F# çñ "H  !F /Z ,  
v
 ;! ?  ;
 ]   a F", "$ /N  =>=. #  IJ‡ Z*+! .a!
 *+! ‚  .=) "
 ì


 ì  r ï. ! î*( š Z
 *+? q Y  . "?î T î",,*1*(  Ú 
# ??
#"? (~)
??
Z;ÊÑ;jh&?"H  ]  &  ?  ] # ( - 5 5݃ŽI
J *1*+cF N  ] ]

+ [!
"H   I 0I.3 I 0&• [Z ,   /! ?  [
 ]  
K
­
",! .Á 
F )*+ N !  *1 !F  G >=.)*("? ¡Ð N 
  ",  I;kÐ
 G  l Ÿ# 5
ò >   ?   ",?*4*+? œ*( 4/# ?? #"?  @    eb
O‚I  œ"? > ./5 ?   ;=.!
v
!    !  F, 5 .!=)
•  ! @  c • :"  ! ‡"?"?< 
c9T N 

  ",  F]
 –
 q ! .>=.
"?q
’i
 =)
g~)^€ *1
 T‚ N 
*1 
 , . .
i‹ T >
 T q
.

 5c","?< 
T?€r*+

N 
*1 
 , .  ^]
 
   ! .h=."?1õ‹jhâŠD 
4
5 5", 4! ## @   $? > !ƒŽI

4.2.3.3 Les apports des communications asynchrones


`
 .Á  @  — ?] ! Ÿ. L  Ç*+ ??
Z W H_
 "$
.  W
Ç N *(   .  È 
—
 >=.)*( "? 1 H ?,] ! ?4 H  *+ Ief !=>=#  
  +  . 4",*1*+."?  
"H .
 @  
 €
 , .q
   
.a",
FN !    ?   @ 
• q# @ 
 <.! A
…
 # !q *4*+   .cq 
5 /ì N 

  ",  I F€ *1
 ì . @  N 
C"  ! a
?!Q9Ú M", ?!M ]  Q?
v
",*1*(
: N 

  ",  c N  , Ê
/ 


!
: 


 p
/=#
 
çñ"É/ H 5! 5 I  ! 5Á
v
@  WN !    !R ± ?]",  UH_
 "$ .   @ 
F?! ¡
  @ ! . Y
¡ X"  ! R
",?*4*( #) "?PC# ?,
#"? 
&¿ P ]  
 
/ ! 1 #. > ./  R


 DC 
",*1*(
+]
 ; 4*+ ?,
Z -
H_
 "$
.  (   +
 "?
4
 +=)  1N  > .! .~5 5
 "\
@    ƒf4 > .
! @   ; 5 5*+? "$.Z 1 1  ]
. ?1  \]  Ik "? > .+=.
Ü,
 N   Ÿ#
"H  … a",*1*(
/ …
!

  , f =>=# #
F  [*1
#N  !5 )&
N 

 .1 4",
 €
 \?] > . \ , # 
 Z9 Â"?44# Z.
 *+?  -",*1*(  I

©Kamal AOUDA 2005 www.kamalaouda.com Page 93 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Ñ d*+;  ",*1*( N /


+ ",# . 1 . .
;  !  # 5
?] _ 1"  ! •

(
"?"! 4;#
"??  1  
  \N 
  
Z-’i-(N 
+",
)  I
`
 T*+ ??
Z :) ] ‹ :?! -5  "
  <#*(! i

! . T
-*+ h .‹
 ©?]
#‹"?
Z
#1’)É =) ’(Iâ‚ #
",*4*(
(]
 ] *(! f 
!    ?  ì
  4

  ",  
O0Oï#"? @  Q",*1*+MC N  ]l]
G
L š>  ÐÎì š
 
5 ì 
.P",

N !    ?  1 4?! 
( ! .."B  =. I

4.2.3.4 Transformation des invocations distantes en appels locaux


`
N  ?]",  S P*+  $  ¡ , 5! . ¡N 
Ceb
OV~)#*( .C*+ $

,ƒF H 
L
."? , 
",*1
 €  @ 

=. K
 9c  .  [   ?! . [ A a .*1:# !… Ê 
 
 iR N 

  ",  IÊJ‡ > .R ?]",  q!q=.  “_

 @  *+! A]
 D R
. 5
", DÊÑ;j ç'j>j è I
v

•
 4",*1
##1? 4# 5*1
 \  •  >=5)*( "?  , ,  *1> 5! N €

  @  ?
v
*(
4-=. "B  
 *+? )I
 Ñ;j•~”*( .…Ñ( $
j“,]",  ƒÊ H K
  Ì j @ 
 )*+ 9c
"  ! [*(
 

 ‚ 
Ê
v
 Ÿ# 5- , 5! 5("%!  H 5ç)9 ç) .1 - Ÿ# 54
 "? - 
•  4b † ÑS =>=# #! .1;"?  1 
•  @    
 ![ .?] I #"? @   N Ì jœ","$ …["  !  5! . :",*1
 €
 . [ .
"$

 @  
"? ?? #
v v

 ?] @    4 Ÿ# 5+ , 5! 5 & 
*(
 

   ;!;=. •",*1*+ N   4! .?] !  

 *+d*+(b † Ñ;I
“j 
   *+! ‚   ",
 €
   ‚  1 .H=#> 5;/


 ;
/ÊÑ;j 5 ! f=>=#
"B  4]
 
ðœJ ›ñj Z7Â
"?R9S
R
. >", l
.
) 5 #¡~5b
‡Ñ &Êb! ]P*( .lÑ( $  . 5", ƒŽI Ì
v v v v
5  : a] .  q3I Îaab! ]…0…"?c
. 5", ac . c#*1
 "? —!p N j“? 5)  pj“? .5ç”è-)
. 5", ~”j>j è ƒœ
 *+ h #+?€;eb
O/4",*4*1

 @  ] 
"(  ^

  ",  (J‡è+ÊO Ì I
v v
JK "#< .*+! A . @  N 
…"  !  ?] @  T r*+  $ : , 5! .cN 
qeb
O[ =5 p
#*1 
  Ð
 +9ô
РŸ# c
. €?_Ð
  ìH 
IJ‡M)
 …"  V ", *(! F 5? . M  
*+ $
 - N  Ÿ#  , 5! ”Ij“, , ",
 +]
 ; + 
É?
(b
âÊkpj4 .?] • ;"$ *1 -] .
 N  Ÿ# ‚ , 5! ”I•JK*1*+… c*(! ##c F=) Z # 2c F .*1 ?  a


 !=. KÊ 
­
) "$ *+! N 
 4#"$
 . "H 
#4+","$  +  
 # 44*(
< 4è\‡jhI
` ` `
 ", "$ VU# =# #",U~”Ê [
î & *( .ï=#. "?  _ .ƒ:=.
)
 cì, 
ô  

 ?=.)*(  -   ^!>]
 ", +
"? ??  # +  ",  ! N eb
O , 5! )I
`
g ÉH  5r!R"$.Z‹g  Z  4  ‹ ?]",  ‹#
Ü  qr,  q] 5‹  geb
O

 , 5! 5 I

©Kamal AOUDA 2005 www.kamalaouda.com Page 94 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
FZ ,   
 ",
 €
   / . 5 f  


  !=. •]
 … [
. >", /ðœJ
• ` v
~  1"ÉB
Z ‡.Ÿ  ]I“  ”I f"ÉH  !Ÿ. ]I“  ”I f"ÉH .>] 
?  #! • *1
  " .*+! "? h 5
=. "H  ƒ'I
Figure 40: Modèle en couches RMI-IIOP183

{ 5 K$ 
#!!*+? K  Feb
Oq  
!! …*+ $   ",  a
 c 
.*+  $
 
 , 5! .  IJ‡ h ./  . F )*+ œF*+ > ##©,]
#a a > .) % ! ?  1=5Ü,
)&Z7Â"?
 @  \  P ?]",  D , 5! . D?! 1 #.H=.*+
 ll
  P ",?€I Ì   L  
N  ?] @  ‚ #
"H .*+? K  *+ $
  H 5! . 
a"$ @  ceb
O‹ a"  !  N 
# ?!F9c

 Ÿ#  ! .)*+   #
 "? ;²?¦¹²1¨ £ª+àª+©+Fá â I J‡1)
 !;"$.Z; 
 51N 
  •  
ê `
*+ $
 V ",  ìï N eb
OŒ
r 
   Z ‹ Y# @  d .ï#
Ü ôÚ"  ! ”I N  Ÿ#
 ! .)*+   # , œ*1 14?]
#9F N  N 
;, 5 .  ?4! ?    Ij“  *+ # 
 .
  *1
#+N  ?]",  +eb
O›×eb
OF "  ! 5͛×eb
O[~."B=×IH=) Z
# 3Hƒ'I
­

Figure 41: diagramme de classe du session façade184

183
Source: introduction à RMI, http://www.commentcamarche.net/rmi/rmiintro.php3
184
Source : Core J2EE Patterns - Session Façade,
http://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.html

©Kamal AOUDA 2005 www.kamalaouda.com Page 95 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
D! ?  r=.Ü,
S N   *1  S
þ  R ?]",  DÊÑ;j çŽjhj è I-j“p )*+ -!
 *+! (
v
# 
 # 
œ*1
.I
J‡ /(*+<   ",#  4=. (91]! .œ  1*+ ) 5 ( (!>]
  5
q 5! @  g"H*1
?? 5g"$)
 <#‹D N #"$
 . "H 
#DÑ † JIefr!=>=# ^  ‹ ]  
 

)) ] F9c    
,   ‚/! ?  a   @ 
 *1
 *+! .[ =.Ü,
È   ,]",  FÊÑ1j ç
j>j è !.! ",*1
 < .*+!    *1 
 \i’)É =) ’(I
v
4.2.3.5 BMP vs CMP
`
 4!  h_  (?!   eb
O: .  , 5? 5 @ 
???]  Z
.! œ 
54 5 5+ ; 
! 
`



 /9  @    :  /!! 


?!  I  
Z @   @ 
 )*+ [Z #‡"? > .: .  , 5 ",
 ! \d ##D
 "?
‹g
 ]  Tg  g~”O• RÑ-
Z  .  , . "?‹gOÑ ƒ4 ›#T
v v

 ]  (+",? . 
~JK! 5  Ñ-
Z  .  . "? ƒŽI
v
`
. @  N   … , K",?] 
 *+! Ê.*+  #
&f : .  , 5 "?[Z #
:Ê …",! . 
‡ ,
  ; 4 >=.)*(? . @  ;"?  1Z #
1 
 ]  +;  Ief4=>=#  ] 
"+ /OÑ  Í=.!
` v
€
"! .?€F , #) "B  Ò 
‚"$.ZK  /
.
) . !%.„”opN 
 [ , 5 "?%.„”tpN !  >_
  …~)
 :
#*1 <#: p ",  !p N  , 5 "?F]
 q c" :
) *( #r  ã =) p*( $

çA Ê
 
`
?€
 <*+l
("$.Z-! g .
) . ‹  ã͟) 
 S*+ $

烎I Ì ]
"‹
 R",  
"H  ‹l
 , 5 "? [N !  h_q   &K r*1
#N  , ) "H  ![9T€
"! . , pr1 •3 I ",! #
v
 ] 
"î WJAÑ "? U1 œ3ô , ) "H  U  ]
     V?! g#*1
 "?
 UR
 ï!
 
v
 , ) "B  [Z  q
 "?
c
…
=) "$
 Êc !") !  F€ *1=."B 5) ! q!
 N !*1
 
 +  
I

4.2.3.6 Entity façade


`
 "#   (N ! 5! N ?  h_1   @  N   _(1+ 5  \
+
  
!44


 - , 
 
;

.  @  ", .! . @ 
  H f",?  

a‚
   
5;!   ;F*(

 ZF? .a  *(
<  
 Ÿ# 5 ‚  /*(
<  #   
   


 
I…J‡ > .[ .  @  F H    ?! .[ K  
# ??
#"? F."? @  N   =.! ‚
??" ‡
 c , 5 "?F[  W9…"$ @  …  Z ac a 5
 &
, 5"ÉH[  G"$*1C~#"H 
  ?ƒ[
C  C
.
) . PÐ"? > .ì , 5 ",Ð /Z #[  
#   -? #;  ^ 5
  \",*1*++ (#   \! ##   +  !
I
`
  h .)Tef!  h_T{Ü,

‹ *+ pr# ?#q",‹
.
 <*+q",*1
  ! ^  …


 
‹
 ?   \ 
   
.i 5
  \
+
4*1
#;# H # ! N !  “_1  \",*1
 . 
I

185
Ces propriétés correspondent généralement aux colonnes d’une table
186
Une instance correspond généralement à une ligne dans une table

©Kamal AOUDA 2005 www.kamalaouda.com Page 96 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

è(! ##  *1 


!  ;
  @ !  . /*+ *( #",?*1*+
&  > .)# 
 f  .=) "+  
 # ! &
  *1 . *1 #;*+ ??
Z (
"$Z
+! ##  ( =h=# #? 51  +  *1 
 
  *1
#+N 
  \9 ;
!44


 
I

 5 _ ‡   =h=) )*-   

*+ #
 " ç) ? ! *+ > 5 …#
.

 #
v `

 +€ *1
 4

 4
4    ]
#+b!0eeF   Z1 > .)
I +=) Z
# 0#
# ?! .   *(
< 
­
#   
 ,N 
  "  
 @  /*+  ", Ik‚+"?*(

< )*(  ! 
   ?  !  ] œ
 
g
   
.
# ?!  IAkD*+d*+D
 ‹9¡
   
.r . T ?] ! \d #r
??"
 ?€
 =>=# #? . ]
   .  @  N  =>=#
"B  I‚â‚F 

 ?! @  q :"  ! ‡=h=#
"H  …:*( _ 
 
­
]
   . ;& @  [3,2/
. +?! *( _ 
    .
 +9?1

?  • @  / "  
 @  
#
Ü, +*( _ 
 3,2I 2
2 21"  ! 5+I

! "#
! 5? N eb
O @  N  ,_; 5
  4
  *(
< #   
  & ,=5./"#
 2
­
 , 5 "? R N !  h_g  g
(#
"
 #(  r! . 
,?"
 q

? \g"$ @  
"  ! 9Ú5  Fš Ú
!ÐÐ


 Q~.? 2
2I 2
2
2š , 5 "? Q
Z # 5? [ 
­
5 .!=#
   gR"  ! 5?ƒ'IpJ‡ ‹ , 5 "   ‹
  $!) @   ‹ ?=)  ! (r!
 *+! \  4 
*+ *( #"H?*4*+
F*-  Z
 *+! œ 
  #. = "; ‚  .*1
"? ,? .a
fZ  #
  i]
  
I
Figure 42: Modèle relationnel de données d’une clinique médicale187


-#*+   i9r"? q
5
 <*+ q g h .)‹ef?  “_‹{",
g
. !Tgr",?] >  ^
v
 !  h_1   @  ;  ^ 5
  +#? Ì ðjheâðF † j Kj ð‚I
v

187
Source: William Crawford, Jonathan Kaplan, J2EE Design Patterns, O'Reilly, September 2003, ISBN: 0-596-00427-3,
368

©Kamal AOUDA 2005 www.kamalaouda.com Page 97 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 …! ## a 5
  …?? ‡] .!
 …
!… …",  
"H  c “›#cq  *1
  a   Ÿ# 5[b! ]q
*(*+? ("$.Z*+? ;ò‚
 
 5 †        ! O• (~#"Í=”IH=) Z
# Î ƒŽI
v ­
J‡    Z# =>=) "  / Z ,  1  .  H 5"? 
 ]  11",? . 
f~JpÑ ƒ‚*( 
v
 ? )*+  \
",*1  ^ 
, 5!     \    *+ *( #&  ( .*1^;# !!1  + #.=) " I

Figure 43: Pattern Entity Facade188

188
Source: Idem

©Kamal AOUDA 2005 www.kamalaouda.com Page 98 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

5. Gestion de la performance dans la phase de codage


k‚-"? h . 5  ; B!. @   ,   s
k Ð# ] F  S)# .R=)# @  *1*+? ",*1*1 ! P .lG",


ZL l Ÿ# 5 @ 



#! ##! D$
    *+? r
Y X",, ) "H  UN 
 ±

  ",  ïX",*1*+#"?
 
"H .
 @  ;~.!;##+9  1!
"B  3 I 
",
!,) ##    , .+1", \ Ÿ# >?ƒŽI
­
k 
.
! ^? !  !+
  - ]
 .-*+

 ! 
 *1"B ”I

k 
.
! ^? !  !+
!  *1 !  ( h=5)*( "? ^ Ñ^_ @  I

k:=. #‹ ‹ ? A  \  F=. "B  
  . 
$# a‹ ] .  7‹Ñ^_ @ œ ^
 

5  "
  <#*+? "?    @ 
H",! ) 
 ? 9  N *+   .  ( + >=5*( "?  I

5.1 Optimisation des principaux composants J2SE

5.1.1 Les chaînes de caractères

5.1.1.1 Concaténation des objets String


8 / Ÿ# ‚œ ) Z[ , K *1*4
 …~>=)  ƒŽIJ‡ a  Z
 =)  @  … . @  N a 
 > ) 
 …
 a"$,' 
‡
a",."B .<#[  N  , K
 /
?  
 F… [*(
 =) ”IJ‡ h .a",."B . ) ,  @  FN  *15 5? . 
",! @   "? /  p  >=.*( "?[ / .  /…", ", .   IefF=>=# Ê . @  N 
*(F9Fb! ]a[#   !‡
 F .  /? 
  *1
  @  Xœ ) Zc ¥aÆ  : §•~.[ K
5! f œ #) Z
?ƒŽ& F",*1
   .
‚=h=#
"H  F <#[
 F
  .  a
 ",*1
 € 
@ 
H , ”s!œ #) Zú  ¥~) !’gœ ) ZOf?=>=#)~5ƒ)ƒ'I 
 ~. ƒ'I 
 ~)!ƒŽI 5œ #) Z~.ƒ §

k q"? h .‹ .  ‹*-


 @ 
‹g ! ^",H 5 5 @  D g",*1
   .
^D
."?  ‹9D 
‚
"#   a?€ Ÿ# 5 


 *+! 5 # /[
   Ÿ# 5F&… ‡I•JÊ  Ÿ# 5?!
œ ) ZOf?=>=#  N  Ÿ# # >
)  *+  $
( 5
œ ) Z~.ƒ'I Ì  #< + N  .  1  $  1 
 ! . 
 i] .+ N  Ÿ#     ?*( i] .+  !?] Í Ÿ# # 5
) ;"? > .1*+ $
I
`
 4 Ÿ# 51œ ) ZOf,=>=#!
 
> ?! œ*(
 =) 
  
Ief;N ! # ( .*+ 
&
 ! f 

BŸ.! .\g 
\?, . .‹ q",."H .<# ?r R"#   TD?]  ?€T Ÿ# 5
I 

v
=>=#
"B  œ
 ; .  1"H*1*+ • ) Z/  ¥ Q  (?! •
 1 >=.)*(? 5 @    ( Ÿ# 5
œ ) Zc#"? @  N   "?"
! *( [*+ *( #a Z  <#! *(  a"$.ZF/ #. ] 

f  Z
)
Z",  
"H 5œ~ @ 
?
 œ ! .>] 
  =) 1N   *1  / *+ *( #/  + Ÿ# 5;
 ! . %.„”ˆñƒŽI

189
C’est à dire ceux qui ne sont plus référencés par des handles.

©Kamal AOUDA 2005 www.kamalaouda.com Page 99 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL



 …",*1
##q N  *1"H ‡ F
  .  F
:", ", .   [ 
  [ >=.)*( "? 
v
 +
.
?!+ 1",*1!. ?( ^  ?€1 .
Z.*1*+ ^ 
 ]? 54s

Tableau 17: Concaténation String vs concaténation StringBuffer


äå3æAçÀèXépêjæAèXé0ë å3æ®èXìXíKçîléðï0ë æXñ äå3æAçÀèXépêjæAèXé0ë å3æ®èXìXíKçîléðï0ë æXñjòóÀô ô^íï

î#éðï0ë æXñÌõ®öyæAíX÷Õî#éðï,ë æAñø^ùú î#éðï0ë æXñ3òDóÀô ôpíï3õÑökæXíX÷‹îléðï0ë æXñjòóÀô ô^íïÈø^ùú

å3æXñÌõépèï[éSö}î#üXõépí3ý çXóKïÈï^í3æ¶épÿDë ý®íÌë ë õXø^ùú  å3æXñÌõépèï[éSö}î#üXõépí3ý çXóKïÈï^í3æ¶épÿDë ý®íÌë ë õXø^ùú 


û ûû û ûû
îlþ épèï[éKé0ë ý¸ë æAñ îlþ épèï[éKé0ë ý¸ë æAñ
 
ôpåïSø0ë æ¶é#ë¶ö 3úKë    3úKë  ù 


õ ö 0è  ú ôpåïSø0ë æ¶é#ë¶ö 3úKë    3úKë  ù 
 

õ è Aíjæ
 ø,è 0ùú

å3æXñÌõépåÌö¸î#üXõépíý çXóKïÈï^í3æÀépÿDë ý®íÌë ë õXø^ùú  þ
û ûû 
îlþ ép
å žéÈë ý}ë æXñ å3æXñÌõépåÌö¸î#üXõépíý çXóKïÈï^í3æÀépÿDë ý®íÌë ë õXø^ùú 
 û ûû
îlép
þ å žéÈë ý}ë æXñ


JK*1*+   ! œ 1] 


f ;=) Z
# & 
#*1 <#; .
"$

 @   Z*+? .; *+  
# *+?
­
­
  .*1[r# !‹!#"? @  r T",*1
   . A
 "#
9T"$ @  c=. [‹?]  ?€
 Ÿ# 5
=>=#
"B   F", ", .   Ief;=. f)) <#a
  N @  ]  œa N  .  
륝¦”^ ¦¨§n , 1r  ¥~) !’gœ ) ZOf?=>=#)~5ƒ)ƒ'I 
 ~5?ƒ'I 
 7~ ¦”^ ¦”ƒ'I 5œ ) Z~.ƒ§
`
 ?€
 <*+; .
"$

 @  /
•?F5 œ ;=. @  /
 "?•;=.
Ü, . .  ] / ",."H .<# Å N


F c
?=>=#Ê ! .) aFœ ) ZOf?=>=#×I Ì  "
[!?]  Ÿ# ‡ N  , "#
F 5! @  c c
?=>=#
 N  , •
+?  <#*(! #*1
  Ik
 1 $ ;4 ! .1 5 Ÿ. .\] .1 *+d*+1 Ÿ# ~.
"?(=.   _( . *( \
4"$.Z4( #. ] ?
 +Z
)
Z1",  
"H 5.ƒ'I

¨K© ²,¬4¸ ª1³¦¤5¬5£«?¬\¥©l«¦ ¬.©¤(æ¹ ©l¨ ©¡·,¦ª1³


¸ ¨ £ ¬.©¹
¤4«
à £³
³
¨ ¸ æ¹ ©l³£
²R¨ £S¨ ¦
»¸ æ¹ ©l³
¤#Â ²!©«!¬.Â
©D·¸ ©
ë
¥© ²?² ¹²Cºì¬5¦¹²ì¨ © ²L¬hÅ
³© ²C¥Ã ¦³ ¤.£ ¬¸ ¦«²
IefM=h=. a +š 
4*(ìV#   !: 

.
Z.*1*+ ?=).   "!.
./
-N  Ÿ# 5( 


 *+! 5 # (",*1*+  N 1=. •
œ #) Z/
¥;    §! õ  ö,è  ú

=.~) ! %¥;2:§ -Ïa3,2


2
2
2
2E§  Eƒ>Ô

œ ) Z1r¥¦Žò  ^¦¦×œ .


 _"¦ ¦Žk‚¦n§

©Kamal AOUDA 2005 www.kamalaouda.com Page 100 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Figure 44: Comparaison de la concaténation String vs concaténation StringBuffer190


 1",*1
   .
"? h .; " 1 H  @ 
 ] ! .+9   " s
v
épíý Ñö (í å¸î#épí í  ü  èjæ ú
ûû û

ôpåïSø0ë æ¶é#ë¶ö 3úKë     3úKë ù



î#éðï0ë æXñÌõ®ö épíý ú



k L*+d*+L  ‹ . R .  RR 5


  ¾ 
 ]! 1?? ; @ 
 ] ! . RD .*+ g

 >=.)*( "?I

191
Tableau 18: Trois opérations qui ont le même impact sur les performances
Aêï^èXéÈë å3æ ê 3ó ë ìXè3óÀé Aêï^èXéÈë å3æ"}ê 3ó ë ìXè3óÀé Aêï^èXéÈë å3æ#

!
!
Fï0ë ìXèXépíÌõépèFéÈë çô0ë æAè î#éðï0ë æXñ('Xí åkö&(í å  ú
û ûû ûû
Fï0ë ìXèXépíÌõépèFéÈë çô0ë æAè î#éðï0ë æXñÌõépí í üÌö 
î#éðï0ë æXñÌõ®ö $ í å¸î#épí í ü û û
î#éðï0ë æXñÌõ®ö $ í å  ûû û î#épíKí ü8 ú
ûû  (è3æ8ú û
,î#é^íKí %ü  &(è3æ% ú  ï0ë ìXèXépíÌõépèFéÈë çô0ë æAè î#éðï0ë æXñ èjæÑö )
F  è3æ ú
û  û

î#éðï0ë æXñÌõ®ö*'Aí å õépíKí ü  è3æ ú


ûû  û 

fe G#] "$ C  D,€¡ .  D 


 ]? . S N  =>=#
"B .! 
S  S >=.*( "? DL 
*+d*+;*(
 <#I

190
Source: adaptation d’une figure publiée dans : Doy Bulka, Java™ Performance and Scalability Volume 1: Server-Side
Programming Techniques, Addison Wesley, June 05, 2000, 0-201-70429-3, pages 320
191
Source : inspiré d’un algorithme paru dans le même livre

©Kamal AOUDA 2005 www.kamalaouda.com Page 101 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Tableau 19: Deux concaténations qui ont le même résultats mais pas les mêmes impacts sur les
performances
Aêï^èXéÈë å3æ#( óXõ+Aíï[ô^åïÈý®èjæÀépíóFí Aêï^èXéÈë å3æ-,
û
ôpåïSø0ë æ¶é#ë¶ö 3úKë     3 úKë  ù 
ôpåïSø0ë æ¶é#ë¶ö 3úKë     3úKë ù 


 î#éðï0ë æXñÌõ®ö $ í å  ú
î#éðï0ë æXñÌõ®ö $ í å  /î#épí í ü+ $ è3æ% ú ûû
ûû  û  õ ö , îlépíKí ü  ú
 û
 õ ö $(  èjæ8 ú


êKõXó ^é èXé0/Fý®å3ë æAõ12 ó æXí¸ý¸ë ë õÀíKçÀå3æKí êKõXó é^èXé0/ # 3 }  ý¸ë ë õÀíKçÀåjæ õ
. û ûû . û
ûû

“j +# ??> /ì M",*1. ?LÐ"? P =>=# #! 5 l=.)*1


   @  ì š >=.*( "?Q 
 .  \4", ", .   + ,
#) 
! 5 #+s
`
4]) 
   . 11#  
 5 ( .)*+ \+ 5   1 ;",! .
1~#+=>=# 
+ N  .  +Î

  ",! .
1 • ; 5   ; œ ) Z + ,  5 Ÿ.
.1 *(d*+ @   @  ;? • 1] 
 Ief
#] "$ R
!g N  .   œ #) ZDT"$ZR
g 5   D -
D",? .
‹T=) + -9
­
*+  
#+   
.
Z# ?  (   "  ƒŽI
`
:*(*+? ˅ c", ", .   F!:
.

 s
a
 [ .  a",*4*+[œ ) Z… ¥

¦Žò  Ð  ¦ú ¦×œ .
 _ ¦ú ¦'k‚" ¦n§‡ r", ", .   : , ^# ?  
%.ˆ”64T*(
T",*1
    
`
#"? @  Ú  C"$H'  L", ", . 
 L?? =) €  
I Ð .*1Lš# !!ì , …
",! @  ! / ?=# ) 
9L"? 
 ¡ .  P5 5?  
 l"$,' D9C",! .

]) 
 + 5 .
 -+*(

1€
"!  I

5.1.1.2 Comparaison des chaînes de caractères



f",*1
##F N  *1"H • *+  $
 1F =.*1   / @   ~.ƒ‚ 
‚ a >=.*( "?F
v
   +
."? 9 1",*4. ?( \Î1" 
?! ^
 ]! . 4s
465 7 89;:<
 ó = ë çžç èKõÀõäå3ý Xèï^è3ë õÀåjæ 
F  3äå3ý AèïðíïKí3ó>®ç?'Aè@0æAíKõÌë Kíjæ¶éÈë óXíKõ
û û

 ó = ë çžõépèXé0ë çìXå3ë k
F  ý®èjë æFøÈî#éðï0ë æXñÌèï^ñKõ?A Bpù
û
î#éðï0ë æXñÌèkö $(  í å%r C åï   ú
ûû û

DFEHGJI KL(MN O$P95 5 Q?RSQGT5 U O$V


å3æXñK  íF= óÀéSö¸î#üXõépíý çXóKïÈï^í3æÀé[ÿDë ý®íÌë ë õXø^ùú çÀåý¶épí3óKï
û ûû
ôpåïSø0ë æ¶é#ë¶ö 3  úKë    þ   3 úKë ù



192
Cela signifie que le compilateur élimine tout simplement les signes +

©Kamal AOUDA 2005 www.kamalaouda.com Page 102 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

è í 3óXè X õ øT=Aùú
û
þ

å3æXñ®ôÈë æÌö}î#üXõépí3ý çXóKïÈï^í3æ¶é[ÿ(ë ý®í}ë ë õXø^ùú
û ûû
î#üXõépíý å3óÀé Fï,ë æ¶é æFþ 
ø SéÈë ý®íkö  ø[ôÈë æ Kí=KóÀépùSùú
þ þ
û  W


465 7 889 X <

Fó = ë çžç K è õÀõäå3ý Xèï^è3ë õÀåjæ"  3äå3ý AèïðíïKí3ó>®ç?'Aè@0æAíKõ1jë ô ô^êï^í3æ¶é^íKõ


û û
Fó = ë çžõépèXé0ë çìXå3ë ký®èjë æFøÈî#éðï0ë æXñÌèï^ñKõ?A Bpù
û
î#éðï0ë æXñÌèkö $(í å%Cråï   ú
ûû û

DFEHGJI KL(MN O$P95 YQ?RSQGT5 U O$V

å3æX
ñ K í =FóÀéSö¸î#üXõépíý çXóKïÈï^í3æÀé[ÿDë ý®íÌë ë õXø^ùú 
 çÀåý¶épí3óKï
û ûû
pô åïSø0ë æ¶é#ë¶ö 3úKë    þ   3úKë ù


è í 3óXè X õ øT=Aùú
û
þ

å3æXñ®ôÈë æÌö}î#üXõépí3ý çXóKïÈï^í3æ¶é[ÿ(ë ý®í}ë ë õXø^ùú
û ûû
î#üXõépíý å3óÀé Fï,ë æ¶é æFþ 
ø SéÈë ý®íkö  ø[ôÈë æ Kí=KóÀépùSùú
þ þ
û  W


465 7 889Z[<
Fó = ë çžç K è õÀõäå3ý Xèï^è3ë õÀåjæ%#+  3äå3ý AèïðíïKí3ó>®ç?'Aè@0æAíKõ1jë ô ô^êï^í3æ¶é^íKõ
û û
Fó = ë çžõépèXé0ë çìXå3ë ký®èjë æFøÈî#éðï0ë æXñÌèï^ñKõ?A Bpù
û
î#éðï0ë æXñÌèkö $(í å%Cråï   ú
ûû û

DFEHGJI KL[MN O\ZP)95 5 Q%R]QGJ5 U O$V

å3æX
ñ K í =FóÀéSö¸î#üXõépíý çXóKïÈï^í3æÀé[ÿDë ý®íÌë ë õXø^ùú 
 çÀåý¶épí3óKï
û ûû
pô åïSø0ë æ¶é#ë¶ö 3úKë    þ   3úKë ù


è í 3óXè X õ øT=Aùú
û 
å3þ æXñ®ôÈë æÌö}î#üXõépí3ý çXóKïÈï^í3æ¶é[ÿ(ë ý®í}ë ë õXø^ùú
û ûû
î#üXõépíý å3óÀé Fï,ë æ¶é æFþ  ø SéÈë ý®íkö  ø[ôÈë æ Kí=KóÀépùSùú
û  W 
þ þ

©Kamal AOUDA 2005 www.kamalaouda.com Page 103 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

)*1"?  . " 


?! "!N  , ‡JK*1. ?3 @ 
*1 a :*( /F .*1!/9…N €
"! .
v
#~ ?]
 .[3
3,2*1    !
", ?ƒŽ& 
 ]
 JK*1. ? ÎF~#?]
 .÷
2
2*1    !
", ?ƒ‚ 
 ]
 
;JK*1. ?0~#,]
 53,x
2
2;*1    !
", ?ƒŽI
JÊN  , /
 "L  G"$,'    !  @    @ 
\

 ! a š*+   
#ì >=.)*- "?Q ] 
"L 
*+ $
a @  ~.ƒ'I Ì ] 
" c*+ $
a @  
j Z.JK
!~.ƒÊ"!N  , K N  ?] .! @ 

!…
.

 •s

 F  _[[ =>=# # "? /! #c  /"$,'  /",*4#
 / K*( F c
.
Z.*4*+c*+ ‚
.*1^94N €
"! .×I

5.1.1.3 StringTokenizer
œ ) Z ðÉH
 ö‡ , ‚ “_

 @  *+! Ê!    ! :
p :.  Z… "$,'  /…",."H .<#  I•‚N  
 , K?    ! F9a! #. "?&•  ! ] 
 K
 ] ) 5  F?
#"?a",Z H  IJ‡ > .!
"B  

.
!V
Ð Z
) $
*+Mì 
,  !   @ 
-=. a
 +?€ *+ $
 M € è=)~5ƒ
 
, ) Z~5ƒ  ;" 
?!+œ ) ZI

465 7 889;:< ^7G8%I K%LU_ `K9a%b%7%cTK9 U 9 a7G7 adEfeG98+7%g%9 a5 9 DhETGJI KL?i0Qjd9K?I k9G

Fï0ë ìXèXépíÌõépèFéÈë çìXå3ë -lmnÒÿ#åní3æ ë oAíïÈøðî#éðï0ë æXñÌõÀù


î#éðï0ë æXñÌõXó Ì = öyæFó ú
ûû
î#éðï0ë æXñFÿ#å n í3æ ë Ao íï3õéjöyæAíX÷Õî#éÈï0ë æAñFÿ#åníjæKë oAíïÈø^õ  0ùú
p p
éðï[ü

÷1'Kë ¸ í øSø^õXó =Ìö¸øðîléðï0ë æXñKùSõé æAí?>Àé[ÿ#åní3æFø^ùÈùhq ökæKó ù


û ûû
 0r(åïÈýÑè ü üXåóž÷åó ÌçÀåþ ýFóÀépíÌõÀå3ý®íXéT'Kë æAñ¸óXõÀíFôðó A' íï^í
ûû û û
  =KóÀéSæXåXéSp æXåX÷èKõ÷íÌèï^íÑéÈï[ü ë æAñ®épåyë õÀå èXépíÑJé 'Aí þþþ
û
  þ þ þ Xíï[ôpåïÈý®èjæAçÀíÌçÀåKõéåXô3è¸î#éðï0ë æXñFÿ#å ní3æ ë oAíï þþþ

þþþ

çÀèXépç?'Ñøsr(å î óXç?' t  í ýÑí3æ¶ést>XçÀí¶éÈë å3æ®íÌù
û 


465 7 889 X < ^7G8%I K%L`EHI 5 I 87KuE5 9 8+vw EJb%Q U 9 8I KU 9%x?y6zH{|F9%E8%` M%8dEHGJI K%L{|U 9(5 7a%5 7 889D0EHGTI KL
Fï0ë ìXèXépíÌõépèFéÈë çìXå3ë ¸ýžüKî ë ý  íFÿ#åní3æKë oXíïÈøðî#éðï0ë æXñÌõÀù
û
î#éðï0ë æXñÌõXó Ì = öyæFó ú
ûû
ë æ¶é#ë¶ö 3  ú
ë æ¶éjl öÌõ ë æ%K í%>?N  ôðø 0 ùú
÷1K ' ë í¸ølþ 3} ö F ù p
û

©Kamal AOUDA 2005 www.kamalaouda.com Page 104 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

õXó =ÑöÌõ õXó=Aõéðï0ë æAñø,ë [l ùú

 0r(åïÈýÑèþ ü üXåóž÷åp ó ÌçÀåýFóÀépíÌõÀå3ý®íXéT'Kë æAñ('Xíï^í


ûû û
ëö-l ú p  õ%nAë ®åXìXí3ï3çÀåýÌý®è®÷íÌè ï^íKè Xüžôpåóæ
0
û
l3öÌõ ë æ%K í%>?Nôðø  ë ùú~ Kô0ë æyæXí%>ÀéçÀåýÌýÑè
þ p p

õXó Ñ= öÌõ õXóA= õéðï0ë æAñø,ë ùú  0
 å3æ% éKôpåïðñKíXéKéTA' í èKõéõXó A= õéðï0ë æAñ
û 
þ
`
 +#  
 5 5^4"? \,€+" 
?! ^?! 

 (! (=) Z
# 7I
­
Figure 45: Performance du StringTokenizer comparée à celle d’un Tokenizer qui utilise les méthodes
193
indexOf() et substring()de la classe String

5.1.1.4 Tri des chaînes internationalisées


`
 )Ê R"$H'  g¡",."H .<# ¡ ! .)    !
 R , 
 ¡ .  ¡",*1
 €  @ 

¡
`

"? ?  .‹ N 

! 5  : … Z
) $
*+ … )•9g N  
$   A?€T ",  . !    ! 
I 
" 
?!4Ÿ. ]I .!€! )I JK   5 =>=#…  /*+ $
  K  
. ) . /# @ 
 ! 
=h=#
"B  ‚"?
`
Z
#  #)C*( –, 
 ]  z  >=.*( "?   ?! 9    .×I y" 
?!
Ÿ. ]I .€? ”I JK    ø•_1 , •
 ; .)  ] 
 +=h=) ","? @ 
?=>=#
"H    - #) (?€(=. 1
 
.
 *+! )I
`
 …?€T*+  $
 … 
 ]! .  *+ > .? AT"H*1#\ g >=.)*("?N 
 @ 
 "ÉB?5
 *1
 *+! . ;#    "H  ] *(! 9  N  4AŸ. ]I .€! )I JK   5 iŸ. ]I .€? ”I JK    ø•_I
€` I a%jd8%QGmEI v ^?5 wv+9KuEw7%g%9 a‚m7%g%7ƒ Ef9%xETƒ 4‚Q5 5 7%EQG…„H†s‡
 ó = ë ç®ïÈó æAõÀåï[éðø3ù
F
û
ó ë ç% n õÀåï[éðø^õéðï0ë æAñ?
ˆ ïÈï^èXü  õéðï0ë æXñ%
ˆ ïÈï^èXü íjæAñXéT'
p p þ
û W
p

193
Source: Doy Bulka, Java™ Performance and Scalability Volume 1: Server-Side Programming Techniques, Addison
Wesley, June 05, 2000, 0-201-70429-3, pages 320
194
Source: Jack Shirazi, Java Performance Tuning, 1st Edition September 2000 , ISBN: 0-596-00015-4, pages 496

©Kamal AOUDA 2005 www.kamalaouda.com Page 105 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

äå èXépåï ñKíXés‰ æAõépè3æAçÀíø3ùÈùú


ûû 
Fó = ë çžõépþ èXé0ë çìXå3ë  óë ç%nõÀåï[éðøðî#éðï0ë æXñAuB3èïÈï ë æÀé å ë æ¶é' ë
û û
l[èXìXè é^í%>Àé äå èFépåï3çÀù p p p
ûû
 ë æ¶þ éSý¸ë þ kö¸ø å ' ëù"jú
û 
î#þ éðþ þï0ë æXñ¸ý¸ë   íkö}èïÈïTAFý}ë B0úu ðî#éðï0ë æXñ èXépè®é ü Xí
û
 ð óXõÀíKõäå èFépåï çÀåýA èï^íøðîléðï0ë æAñ î#éðï,ë æAñKù þþþ
ûû
ë ôðø3ç çÀåý X  èï^íø^èþ ïÈïTA å+B ý¸ë   íKùF} p Ì ù
û û
þ p

þþþ

€` I a%jd8QGmEI v ^?5 wv+9KuEw7%g%9 a‚m7%g%7ƒ Ef9%xETƒŠm7%g%7ƒ Ef9%xETƒ 4‚Q5 5 7?EHI QK ‹09%Œ1„H†\
 ó = ë ç®ïÈó æAõÀåï[éðø3ù
F
û
ó ë ç% n õÀåï[éðø^õéðï0ë æAñ?
ˆ ïÈï^èXü  õéðï0ë æXñ%
ˆ ïÈï^èXü íjæAñXéT'
äå èXépåï ñKíXés‰ æAõépè3æAçÀíø3ùÈùú p p þ
û W
p
ûû 
 ó = ë çžõépþ èXé0ë çìXå3ë  óë ç%n õÀåï[éðøðî#éðï0ë æXñAu3B èïÈï ë æÀé å ë æ¶é' ë
F
û û
äå èXépåï3çÀù p p p
ûû

H pçÀå3æ¶ìXíï[éKépå}è3æèïÈï^èXü®åFô3äå èXé0ë å3æ Ž#íXüXõ


ûû
äå èXé0ë å3æ # Ž íXün íXüXõ?AuSB ökæXíX÷Õäå èXé0ë å3æ Ž#íXü A èïÈï í3æXñXéJ'uB0ú
ûû ûû û
ôpåïSø0ë æ¶é#ë¶öÌèïÈï í3æAñFéJ' úKëu } ö3 úFë ù þ
û

n íXüXõ?A ë jB öÌç ñ íXþ é^äå èXéÈW ë å3æ #


 Ž íXüKø^èïÈïTA WJë WpB ùú
ûû
  ó æžéJA' íÌõÀþ åï[é3å3æ:éTA' íÌçÀå èXéÈë å3æ+n íXüXõ
. ûû
ó ë ç% n õÀåï[é çÀå èXéÈë å3æ # Ž íXüKøJn íXüXõ  èïÈï í3æAñXéT' ùú
ûû û

 p è3æk  ó æ¶÷: ï^è  õÀå®éTA' èXé ÷NíÌñ íFép åóKp ïSî#éðþï0ë æXñKõÑë æW õÀåï[é^í }åïKíï
ôpåïSø0ë æ¶é#ë¶öÌèïÈï í3æAñFéJ' úKëu } ö3 úFë ù
û

èïÈïTA ë S B ön íXüXõ?A ë B þ ñ íXé^îDåóKï^çÀí îléðï0ë æAñWJø3W ùú


W

 ó = ë çžõépèXé0ë çìXå3þ ë  óë ç%n õÀåï[é çÀå èFéÈë åjæ l
F Ž íXüKøðäå èXé0ë å3æ #
Ž íXü AuB3èïÈï
û ûû ûû
ë æ¶é å ë æ¶é0K ' ëù  p
û
p

ë æ¶þ þ éS þ ý}ë kö¸ø å 'Këù"jú
û 
äå èXé0ë å3 æ Ž#íXüÌý¸ë   í¸ö}èïÈïTAKý}ë +B0úd ^ä|å èXé0ë å3æ Ž#íXü+KèXépèÑé ü Aí
ûû û ûû
 ðóXõÀíKõä|å èXé0ë å3 æ Ž#íXü çÀå ý Xèï^íFÿ#åøðäå F è éÈë åjæ ŽlíXüXù
ûû ûû
þ èïÈTï A 
ëþ ôðþ ø3 å B çÀå3 ý Aèï^íFÿlåþ øÈý}ë   íKF
ù } Ìù
û û 
þ þþþ

195
Source: Idem

©Kamal AOUDA 2005 www.kamalaouda.com Page 106 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

5.1.2 Création/ réutilisation/ importation d’objets

5.1.2.1 Création prématurée d’objets


k +  + Z

Z \, ) "H #
# -",*4*+;Jr  +
.
Z5*1*+ .\!  ) + N $
 44
" #
‚
5! .   ;]) 
  /

! a
.
Z.*4*+Iœk‚ b! ]["? > .… .  @  a , K   ?! .

•  4 >=.*( "?  I € *1
 1
4 *+ $
+=×&
 N  Ÿ# €4 , "#
19 N €! . ) 

v
 ) *+< ##l
¡  @   p!.L!    ! %.ˆ”tuI(ef! .G G*(*+? 4ËS N  Ÿ# (€¡ , 1"#
S  
*(*+? -ËD K , (=h=#
"H # ] *+! 4!    ! &i D",, #) "H . (l ¡" 
?!Sk‚ .D , -
 
]  *+!   *+ *( #4 , "?"

; 
!   *+! )I

 K8dEf7Ka?I 7%EJI QK ^?Gwv7%EJ` Gw 9

ìXå3ë ®ôðø^ù)ë æ¶é#ë ú

(èXépí>}ökæXíX÷ èXépíø^ùú‘m >®íKõéçXï^êKí(Fï^êýÑèXéðóKï^ê3ý®íjæ¶é


ë ôjø ù  }
> æAí}õÀíï^è¸óÀé0ë ë õÀê óXí K è3æAõžçÀíXé é^í(X èï[éÈë í  óFï^åKñï^èý}ý®í
û  
þ þ[þ þ þ[þ
`
 ? !  :9r"?‹
.
 <*+T , Ê #< …  *1
 sʸ ¨« ©:¶.£¹!¬·¤#Â
©¤^¨ à ¦´A#© ¬Aæ¹
©R¨ ¦¤.²?æ¹ Ã ¦«:Æ ©¹!¬
T
¨ à ¹!¬¸ ¨ ¸ ²!©¤Dà”¨ £’,Å1¸ «²,¬5£« ·¸ £ ¬¸ ¦« ¼
á

Y 7?kuŒI K8dE7Ka%I 7%EHI QK


 ôðø^ù
ìXå3ë ®

ë æ¶é#ë ú

ëþ ôj
þ þø ù“(èXé^í>ÌöyæAíX÷”(èXé^íø^ùú
þ þ[þ   >®íKõéçÀå3æAõéðïÈó ëé 2 ë æ¶é^êï0ë í3óKïó Xêï0ë ý+•Xéðï^í}å–¸ë íKõéjóÀé0ë ë õÀê
! û û û  
þ þ þ þ þ[þ þþþ

5.1.2.2 Réutilisation des objets

fe l#< Z ¡Z  . P Ê ? ( 5 Ÿ.


.‹?
$ 5
 ¡
¡Z
. 
R Ÿ# 4l*+ *( #¡ ‡
`
",*1! .q q# ?    !Ê
… : 
 .cN 
:
.
Z.*4*+I T. ?… H @  q T#  
    ?  
N 
/ Ÿ#  ͟.9…"#
a",?*1*+[*(  .*1 …# ??
#"?  @  … ["#   /N 

`
?]  Ÿ# ”I N € *1
 c 
 ]! A*(! # @  q "#   [N 
:?]  F] 
"H .
p H A
 
 .  4*( + >=.)*-! . @  ;  # "B_ " 
Z4N  \] 
"H .  ͟.91€
 , 5? ”I

196
Nous rappelons que ce périmètre est délimité par les symboles {}

©Kamal AOUDA 2005 www.kamalaouda.com Page 107 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

4—Gw 7%EJI QKU_ ` K KQ`g%9 7`1g%9 adEf9` Gh„H†…˜


î#éðï0ë æXñÌõ®ö $  í å?C åï   ú
ûû û
î#éðï0ë æXñ(Ì
 öyæFó ú
ûû
å3æXñÌõépèï[éSö}î#üXõépí3ý X ç óKïÈï^í3æ¶épÿDë ý®íÌë ë õXø^ùú  î#é^èï[éKéÈë ý}ë æXñ
û ûû 
pô åïSø0ë æ¶é#ë¶ö 3úKë æ úKë þ  ù 
 
íKçé^åï ìÌökæXíX÷ íKçépåïÈø^ùú
™ ™
ì è  t íýÑí3æ¶éðø^õÀùú
û
ì þ è  t íýÑí3æ¶éðø^õÀùú
û
ì þ è  t íýÑí3æ¶éðø^õÀùú
û
Ìþ ö¸øðî#éðï,ë æAñKù3ì í í3ý®í3æ¶émˆDéðøHKùú
û 
å3æXñÌõép å Ìö¸î#üXõþ épíý çXóKïÈï^í3æÀépÿDë ý®í Ìë ë õXø^ùú  î#é^å:é0ë ý}ë æXñ
û
þ
ûû 

š 9 adŒ%a%5 7 L 9 U_ ` K1g%9 adEf9` G9%x I 8dEf7KuE


íKçépåï ì}ökæAíF÷ íKçépåïÈø^ùú
™ ™
å3æXñÌõépèï[éSö}î#üXõépí3ý çXóKïÈï^í3æ¶épÿDë ý®íÌë ë õXø^ùú  î#é^èï[éKéÈë ý}ë æXñ
û ûû 
 
 
 
ôpåïSø0ë æ¶é#ë¶ö 3  úKë æ úKë þ ù
 
ì ç íKèïÈø^ùú   íKõÀíXéKéJX' í íKçépåï épå}è3æ}ë æ ë éÈë è õépèXé^í
û . ™ û
ì þ è  t íýÑí3æ¶éðø^õÀùú
û
ì þ è  t íýÑí3æ¶éðø^õÀùú
û
ì þ è  t íýÑí3æ¶éðø^õÀùú
û
 þ ö¸øðî#éðï,ë æAñKù3ì í í3ý®í3æ¶émD
Ì ˆ éðøHK ùú
û 
þ

åjæAñÌõépåÌö}î#üXõépí3ý çXóKïÈï^íjæ¶é[ÿDë ýÑí}ë ë õXø^ùú  î#épå:éÈë ý}ë æXñ


û
þ
ûû 

Figure 46: Création d’un nouveau vecteur vs recyclage d’un vecteur déjà existant198

197
Source: Doy Bulka, Java™ Performance and Scalability Volume 1: Server-Side Programming Techniques, Addison
Wesley, June 05, 2000, 0-201-70429-3, pages 320
198
Source: Idem

©Kamal AOUDA 2005 www.kamalaouda.com Page 108 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

5.1.2.3 Importation des classes


JK! . #*+! 9F
 "._ "? .Z*+! œ#  & N  *15 5  ; 1" 
,!   N  "

`
 *1"H Ê 
i  c h=.*( "? 
I …=. ÊN  *1> .
 :!
 " 
?!T~)A€ *1
 T *15
Ÿ. ]I ’A ”IhOf? > 5^ § ƒ^… 5! 5   c" 
?! [N 
T"!ÉB
Z‹~)i€ *1
 ‹ *1!5 fŸ. ]I ’A )I *A§ ƒ
`
 N Z*+! .Y
 î 5   UY ±*+ *( #U",,*1*+
Y
"?  îU
5
Z.*4*+I  

.
Z.*1*+ .+?] !

 "(!    !? 5! I !  , #) "H  ( *1> @  N   + 4,
$ .! ”I

5.1.3 Boucles for

5.1.3.1 Quel type d’indice utiliser avec les boucles for ?


k 
) *+….&œ"?5 5 ![
.
Z.*1*+ .[ ?] ? p ! @   c"$ €aF h_
 …N   "?


   #+  +] 
*( €
 *(  @  N  ?
#49 +=) (  "  ~)€ *1
   + “_
 
?_! ./
f  ;  "? +
! œ ;] 
f*( €
 *( / ; 
?!/
/3H0‘  ; h_
   $5 œ 
  Q  "? Q  *1 . G9ìÎ 0ì‘
÷
‘ ƒŽIefG=. [  Q "  S=./=. "B  
 ! a   ",
M
 
`
.
 *+! ] 
"+    "? 4 h_
  ! @  !  ] 
"- >! ! ## “_
 I . ?; , @   b! ]
",?] 5  p  [?_! .&• $> K ‡"$Êc ! K ]? K^ ! !=h=#
"H  ‡ F", "
 
&

 a
."?< …9q 
`
",?] .  a ?] .![
 /=5  a", "
 .)*1  I [
.
Z.*1*(F 
 ]! K*+ ] ) =) 

\ =h=) *(  4s
ç K è õÀõ:ÿ#íKõéÈòjüÀépí+
û
F ó = ë çžõépèXé0ë çìXå3ë ký®èjë æFøÈî#éðï0ë æXñAuBèï^ñKõÀù(ë æ¶é >}ö 3ú
û
å3æXñ®éSö}î#üXõépí3ý çXóKïÈï^í3æ¶é[ÿ(ë ýÑ í Ìë ë õXø^ùú
û ûû
ôpåïSTø =¶üÀépíkë¶ ö 3úKë þ #%,"jú ë  ù 
;

ôpåïSøT=¶üÀépíljö3ú›l #%,"jú l ù


; 
ôpåïSøT=¶üÀépínžö3ú%n #%,"jú n ù


ôpåïSøT=¶üÀépí ö3ú #%,j" ú ù
û û ;
û 
>Ìö #  3ú


k F"? h . *1 ) ",  &œ


c  "?…[ h_
 : ! p )*+ KN ! .
 p
aZ
 [c >=.*( "?
‚
N ?]
 .+Î
2m/I

5.1.3.2 Appel de méthodes dans les paramètres d’une boucle for


fe 1#< Z 4Z  . &   =.?  ]
 .N !    !
-
 Í *+  $
4
(  +5*+< ## \N 
 
 " P=.”I € *1
 L
G
 Ð "  @ 
i",!  ! ! 5? N  . . #  @  N  A_P
v
N  *+! 5\
(
 4",  
"H  &   =.! 
# !=# # +H_
! 5 € +019  1H_
? 5 € 3I

©Kamal AOUDA 2005 www.kamalaouda.com Page 109 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

D0ŒKEf7%x%9;:<
ôpåïÈø0ë æ¶é#ë¶ö 3úKë çÀå íKçé0ë å3æ íjæAñXéJ'Fø3ùúKë ù
 ûû
þ
û 

D0ŒKuEf7%x%9 X<
ë æ¶éSý®è%> ë ýÌóKýƒö®ì í3æXñXéJ'Fø3ù
û
ôpåïÈø0ë æ¶é#ë¶ö 3úKë ýÑþ è%> ë ý}óKý¸úKë ù
 

5.1.3.3 System.arraycopy( ) vs boucle for


`
 . @  N 1?
$ .",
 f  4  *+! 5+N 
4 5
  1
; N  *15 . @   #
" 
 ! ”& ! ,
5 Ÿ.
.[#
",*4*( …N !    !A q*+ $
c•_, 5* I ). _ ",?_
~5ƒAc  aN 
a Z
) $
*+

!  
f
 / " 1=.œ~) 5;  *(  @  / . @  /  b † ÑL",*1
   9 ;]
/~5bj ðƒ
  -
",> 5\; h=.*( ",1! ## 
 ; " -=. •_, .*;I . _ ",?_ ~.ƒ??    Z
 =) ! 5?ƒŽI
Fó = ë çžç K è õÀõ åKåÀÿlíKõé &œs
û û û

F ó = ë çžõépèXé0ë çìXå3ë ký®èjë æFøÈî#éðï0ë æXñÌõ?A BpùH


û
å3æXñÌõépèï[é íj æ jú
û
p ž    B0ú
ë æ¶Jé A B3è3ö3æAíX÷‚ë æÀJé A "

ë æ¶éJA B0=KökæAíF÷ˆë æ¶éJA " ž     B,ú

ôpåïÈø0ë æ¶é#ë ö3ú ë è íjæAñXéT' ú ë ùH


 û 
èA ë BÈö3ë ú þ


õépèï[éðö î#üXõépí3ý çXóKïÈï^í3æ¶é[ÿ(ë ý®íÌë ë õXø^ùú
ûû
ô^åïÈø0ë æ¶élðþ ö 3ú l è í3æAñXTé ' ú l Hù 
 þû 
= A l
BÈöKèA l B0ú

í3æ3ö î#üXõépí3ýçXóKïÈï^í3æ¶é[ÿ(ë ý®íÌë ë õXø^ùú
ûû
î#üXõépíý å3óÀé Fþ ï,ë æ¶é æFø^í3% æ  õépèï[é ý¸ë ëÒõÀíKçÀå3æKõô^åï å åçAå¶ü0ùú
û W  ûû û
ë æ¶éJA BçFökæXíF÷ˆë æ¶Té A " ž    B0ú
þ þ

õépèï[éðö î#üXõépí3ý çXóKïÈï^í3æ¶é[ÿ(ë ý®íÌë ë õXø^ùú


ûû
î#üXõépíý èïÈï^èXüXçÀþ å ¶üKø^è  ç  ç í3æXñXJé 'Aùú
û
í3æ3ö î#üXþ õépí3ý çXóKïÈï^í3æ¶é[pÿ(ë p ý®p  p þ ë õXø^ùú
í Ìë
ûû
î#üXõépíý å3óÀé Fþ ï,ë æ¶é æFø^í3%
æ  õépèï[é ý¸ë ëÒõÀíKçÀå3æKõô^åïjî#üXõépí3ý èïÈï^èXüXçÀå¶üKø^ù0ùú
þ þ
û W  ûû
þ
J

199
Source: http://www.precisejava.com/javaperf/j2se/Loops.htm

©Kamal AOUDA 2005 www.kamalaouda.com Page 110 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

š w 8%` 5 E7%Ef8
¸ý}ë ë õÀíKçÀå3æ íKõ+Aå3óKï è*=XåóXç í


ûû û û
• ž }ý¸ë ë õÀíKçÀåjæKíKõAåóKïSî#üXõépíý èïÈï^þ èXüXçÀå¶üKø^ù
ûû
• þ

5.1.3.4 Générer une exception pour mettre fin à une boucle for

 [ " 
 f!/ .)*1  K . @  N 
 F€ "?!  / , fZ  #
&  =.! 
1=) € 
  *1 .*( €
 *( 
    .*+< ## 4 F " 
œ ]
 .•
.
Z.*1*+N =h=#
"H  
 
!   *+! • ;",*1. ?
Ik‚;"?Z #    
& ?=.! f
# !=# #‚ /H_
! 5€ 0
9 1H_
? 5 € 3I

D0ŒKuEf7%x%9Ÿ:<
ôpåïSø0ë æ¶é0A
= åóXç íkö 3ú =Aå3óXç í ë ý}ë é^íý®è%>ë ý®è j í ú =Aå3óXç í ù
û û  û û û 
D0ŒKuEf7%x%9(X <
éðï[ü

ðôpåïSø0ë æ¶é0=AåóXç íkö 3ú ú?=Aå3óXç í ùmðó æXíÌí%>XçÀí¶é0ë åjæíKõé êKç 3 í æAç?'XêKíyë çFëuXåóKïSýÑíXé éðï^í®ô0ë æ è*=Aå3óXç í
û û  û ! û û 
çÀèXépç?F
' østX> çÀí¶ éÈë å3æíKù


5.1.4 Collections Java 2

5.1.4.1 Comparatif des performances


¡?] g",*1#R  ï >=.)*( "? ô î",  
"H  Vb! ]±0&q =.. R  
v
 5 5
Zq 
Ê=. ?! p 

 ^ r*+d*+: . H ”I Ì =) cr*+ > ##qj©?]
.q"?: . , i!
V?*4*+ U
! Ú 
R
Y  "$
*()ÉV
 
  ï
U X  ]
#Ub! ]~5ðÑ\ƒ   h=.)*
v
>=.*( "?s• . . Z  rDð"B  ",H6׏”ØIYJ‡S  "!$
*()ɍ",*1#S ;  r =>=# #! 5
v
h_
  \4",  
"H  
&   i 5*1+ "? ?? # (
”s
Ì .Ÿ ! .;?]  ?€(  *+! 5^9  ",? .
I




) *+ -  *+! 5i1"?1",? .
I

Ì "?"? -=.ÜH(  5 #4?€-


 ^, 5"!ÉH
 ^
+  \",  
"H  
I

#",
)   \ =h=# #? 5-  *+! 5^N 
 1",  
"H  I
• v

200
Steve Wilson, Jeff Kesselman, Java(TM) Platform Performance:Strategies and Tactics, Addison-Wesley Professional;
1st edition (May 31, 2000), ISBN: 0201709694, pages 230

©Kamal AOUDA 2005 www.kamalaouda.com Page 111 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

` `
 *+  $
G3c
"  "$‹ 5r   . , 5q=h=#
"H  ‹+ ¡  "$
*()É!I l*+  $
g0
l
",!  ! … V 
Z @  Ú
", ?? #Ú
a"$
.*+  #…  L .  C=h=# "H 
 Ðc 
`
  "$
*(ÉI  …*+  $

 aÎ&  Ê7q *1
 *+! .! Ê"? F .  …~.BŸ.! ”&• 


# ?  &
­
#",
.^ \  *+! >
& 5
*S","? ??ƒ'I
  %w EHb?Q U 9 : <¡¢wa?5 9Ka?b%9v+9KuEU`Ef9 8dE
Fó = ë çžõépèXé0ë çìXå3ë ký®èjë æFøÈî#éðï0ë æXñA Bèï^ñKõÀù çÀíXé[épíký®êXéJ'Xå Kí‰æ?2 íKõé0AèKõ ë ý¸ë épèXé0ë ìXí
û û
äå íKçéÈë å3æèïÈï^èXü £ ë õéjöyæAíF÷¤ ˆ ïÈï^èXü K£ ë õéðø^ùúd ®
 æ A íóAé ó ëÒèdpl åóÀépíï íKõžèóAéðï^íKõé ü AíKõ1 íÌçÀå íKçéÈë åjæAõ
ûû û û ûû
épíKõéðø^èïÈï^èXü K £ ë õépùú
äå íKçéÈë å3æ ë æ?¶ n í £ ë õéjöyæAíX÷”K£ ë æ?n í K£ ë õéðø^ùú
ûû û
épíKõéðø ë æ? n í £ ë õépùú
û
äå íKçéÈë å3æ:ìXíKçépåï#ökæXíX÷ í çépåïÈø^ùú
ûû ™
épíKõéðø[ìXíKçépåï^ùú

äå íKçéÈë å3æ:éðï^í í îDíXéSökæAíF÷+ÿï^íKí îDíXéðø^ùú


ûû
épíKõéðø[éðï^íKí îDíXépùú

äå íKçéÈë å3


æ 'XèK?
õ 'XîDíXéSökæXíX÷”(èKõ?'XîíFéðø^ùú
ûû
épíKõéðøT'AèKõ?'XîDíXépùú

  %w EHb?Q U 9X;<4—b GHQKQvw%EHGH7 L 9 U 9 8Q^wGH7%EHI QK8


Fó = ë çžõépèXé0ë çìXå3ë ÑépíKõéðøðäå í çéÈë å3æçÀù
û ûû
î#üXõépíý å3óÀé F  ï,ë æ¶é æFøÈ ÿlíKõéÈë æXñ  ç ñ íXé^ä èKõÀõXø^ùÈùú
û  û
î#épåÀ  ÷NèXépþ ç?:' é0þ ë ýÑíïSöyæAíX÷Õî#é^å¶ ÷NèXépþ ç?F' ø^ù õépèï[éðø^ùú
è    ø^çÀùú þ

éÈë ý®íï õé^åF  ø^ùú


î#üXõépíþ ý å3óÀé F  ï,ë æ¶é æFø, è  /
û 
éÈë ý®íï ñKíXést èAþ þ  õÀí F ÿ(ë ýÑíø^ùÈùú
û
éÈë ý®íï þ ï^íKõÀíFéðø^ù õépèï[éðø^ùú
þ ø^çÀùú
ë épíï^èXé^í þ

éÈë ý®íï õé^åFø^ùú

î#üXõépíþ ý å3óÀé F  ï,ë æ¶é Fæ ø ë épíïs/


û 
éÈë ý®íï ñKíXþ ést è AõÀ
þ í Fÿ(ë ýÑíø^ùÈùú
û
ë ôjø^çÑë æAþ õépèjæAçÀíKåX0 ô £Kë õépù 

£Kë õé
ö¸øT£ ë õépùÈçKú
û
éÈë ý®íï ^ï íKõÀíFéðø^ù õépèï[éðø^ùú

ï^è3æKå3þ ý1ˆ çÀçÀíKþ õÀõXø ù ú


û
éÈë ý®íï õé^å Fø^ùú
þ

©Kamal AOUDA 2005 www.kamalaouda.com Page 112 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

î#üXõépíý å3óÀé F  ï,ë æ¶é Fæ ø/ï^èjæKå3ý(/


û 
éÈë ý®íï ñKíXþ ést è AõÀ
þ í Fÿ(ë ýÑíø^ùÈùú
û
þ

éÈë ý®íï ï^íKõÀíFéðø^ù õépèï[éðø^ùú
þ íø^çÀùú
ï^íý®åXìX þ

éÈë ý®íï õé^åFø^ùú



þ

  %w EHb?Q U 9 Z<u¥0mQ`EU_ w5 wv9KEf817`xaQ5 5 9 adEJI QK8


Fó = ë çžõépèXé0ë çìXå3ë }è  øðäå í çéÈë å3æçÀù
û ûû
ôpåïSø0ë æ¶é#ë¶ö 3  úKë r‚¦‚ ‰ ÿ)thÑîIúFë ù
 
ç è    ø^å=§[l íKçépõ?A ë pB ùú 
J
þ

  w%EHb?Q U 9¨©< ªF7GaQ` G81U 9 8w5 wv9KuEf81U 95 7aQ5 5 9 adEJI QK
Fó =
ë çžõépèXé0ë çìXå3ë yë é^íï^èXépíøðä|å íKçéÈë å3æçÀù
û ûû
ôpåïSø0ë æ¶é#ë¶ö 3úKë  3úKë ù


‰ épíï^èXépåïlë épíï#öÌç ë é^íï^èXépåïÈø^ùú
÷1K ' ë í¸ø0ë é^íï 'AèKõ r þ í%>Àéðø^ùÈù
û
=›[l íKçéåköyþ ë épíï æAí%À> éðø^ùú
JJ
þ

  w%EHb?Q U 9«0<%D` ^ ^?GH9 88%I QKU 9 81w5 wv9KEf81U 9(5 7aQ5 5 9 adEJI QK
Fó = ë çžõépèXé0ë çìXå3ë kï^íý®åXìFíøðäå íKçéÈë åjæçÀù
û ûû
‰ épíï^èXépåïlë épíï#öÌç ë é^íï^èXépåïÈø^ùú
÷1K ' ë í¸ø0ë é^íï A' èKõ r þ í%>Àéðø^ùÈù
û
=›[l íKçéåköyþ ë épíï æAí%À> éðø^ùú
ë épíï ï^íýÑåXìXíø^ùú þ
J
þ

  w%EHb?Q U 9¬0<¥aae 8175 w 7%EfQI G9

Fó =
ë çžõépèXé0ë çìXå3ë kï^è3æ 
å ýˆ çÀçÀíKõÀõXøT£Kë õéçÀù
û
ôpåïSø0ë æ¶é#ë¶ö 3úKë r‚¦‚ ‰ ) ÿ thÑîIúFë ù
 
=›l[íKçéåköÌç ñKíXéðøÈï^è3æ%K åýÌø^ùÈùú

þ


`
 +#  
 5 5^! .
!\?! 

 ( ( 5
  -02I

©Kamal AOUDA 2005 www.kamalaouda.com Page 113 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Tableau 20: Comparatif des performances des principales collections

465 7 88%9 ¥0fQ`E ªF7GaQ` G8 ¥aae 875 w 7%EQI G9 D` ^ ^?G9 88%I QK
3  ¸ý®õ ý®õ #   ¸ý®õ
ˆïÈï^èXü £Kë õé ý®õ

£Kë æ?ní £Kë õé


}ý®õ "  ¸ý®õ #  ?"ký®õ ý®õ
­

¸ý®õ " ž ý®õ


íKçépåï ý®õ ® ® ý®õ ® ¯
™

ÿï^íKí îíXé # # ¸ý®õ , ¸ý®õ r(íÌõ%2 è  ë 3óXí




û ý®õ
 èKõ
A ­ ®
(èKõ?'XîíFé ¸ý®õ ,# ¸ý®õ r(íÌõ%2 è  ë 3óXí



û ž ž¸ý®õ
AèKõ

fe (Z  .  ?! "?( . , ?€(! ## \",  


"H  - +", "
 !   *( _ 
 +
 ^ .*1^
# !4? .
(\,*1*+ ^) ] \,€+","   \ 
 ]! . 4s

Jp 
?!*+! œ  " 
?!  *1
 *+! 5! ‚ N  ! .h=."? © ¬œa [
  h=.*(! ./9[ a*( 
Õ
 >=.)*(? .I

3 I ò‚
 $ 
`
0I  
ÉH ò‚
 $ 
ÎI ðf#



Jp 
?!*+!  +" 
?! 4 *1
 *+! 5? • N  ! .>=."? £³1 /
 1 >=.)*(! .;9/ /*( 
ê
 >=.)*(? .I

3 I j !  h_ò‚
 $
Ñ-
0I ò‚
 $Ñ-
ÎI ò‚
 $! 5
 
`
I  
ÉH ò‚
 $Ñ-
­
7I ðf#
Ñ-

Jp 
?!*+! • ;" 
?!   *1
 *+! 5!  N  ! .h=."? ¸ ²,¬•F a
  >=.*(! .9a a*( 
ß
 >=.)*(? .I

©Kamal AOUDA 2005 www.kamalaouda.com Page 114 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
3 I Ì ) . _  ,
0I † 
"H 5
ÎI œ 5"É^~)*+*+; h=.*("?  @   † 
"B 55ƒ
` `
I  
ÉH   ,
­
5.1.4.2 Impact de l’emplacement des éléments d’une collection sur la performance
`
 ;",  
"H  ;€

!! f
   
.*+ $
  œBŸ.! .œ ;  *+! >19a 
f",! .
I
Ñ- Z#  
 ] .  . 1"? -*+ $
 ( ?] ? d #+?" 
 -(?€-Z. -", . Z
)  4s
`
 +*+  $
  @ 
BBŸ.! .!   -  *+! 5^9  +=) (
  ;",  
"H  I
• `
 [*+ $
  @ 
BŸ.! 5! p  F  *+! 5
[ [*1
 "?*+? P 
" =) A 

.*+< #; €I
`
 ¡*+  $
 gP S?€
 <*+S", . Z
) l?? ;*( ¡ h=.*(? .  @ S"?   gG 

 #*1 <#L", . Z
) Ð#", @  N  ]! Ð?]  ! #F  G?]  ,€G  *+! 5S   

 ] !    #  N   ",1( 
 Ü,?  1",? . (  ;",  
"H  I
`
N € *1
 1 5
  ;0•34 )*+ ",*1#  ; >=.)*( "? 4"? 4
?€ ", . Z
)  
 *+  $
 (
 ;"  ?! † 
"H 5×I

ÃMÄ Öf"? [#  


 5 5?! K? ] 
  [
  …*+ $
 … 


# ,  [ p  ! # 
h_
  \4",  
"H  
I

Tableau 21: Impact des méthodes addElement() et insertElementAt() sur les performances (classe Vector)
è  t íý®íjæ¶éðø^ù ë æAõÀíï[Té t í3ý®í3æÀé ˆDéðø^ù
û û
F ó = ë çìXå3ë Ì è      ø íKçépåïì î#éðï0ë æXñÌõÀ
ù  F ó = ë çìXå3ë Ì è     %ˆDTé °3ï^å3æÀéÈø íKçépåï ì î#éðï,ë æAñ}õÀù
û
™ û
™
ôpåïSø0ë æ¶é#ë¶ ö 3úKë   júFë p ù  ðôpåïSø0ë æ¶é#ë¶ ö 3úKë   3úKë ù p

 

ì è  t 3 í ý®í3æÀéðø^õÀùú ì ë æAõÀíï[éTt  í ýÑí3æ¶émˆDéðø^õ F
 ùú
û  û 
þ þ p
 
ÿ#íý AõžçÀå3æAõÀå3ýÌý®ê[/3 ž ¸ý}ë ë õÀíKçÀå3æ íKõ ÿ#íý AõžçÀå3æAõÀå3ýÌý®ê[/ êKõXó ^é èXéT/ž?, 
ûû . û

5.1.4.3 Capacité d’une collection


#"? @  î N €
  ìî Ú 5   ÚN 
 V",  
"H  ì ͟.9ô"#

V , :
 Ú .  
v
   ?! . 
  + >=.)*( "?  &   =.! < + 1 5 
# ]   *1
#+N  *+! 5 @ 

_S!.! , 5
"ÉH l / Q
?!L.*+< #GP",, ) "B .

 ]
 . @  L"? h .
€
  (   4~#€ *4
 s † 
"B 5
ú ] ¥ !’ † 
"H >)~'3,2
2 ƒ § ƒ'I

©Kamal AOUDA 2005 www.kamalaouda.com Page 115 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

5.1.5 Gestion des exceptions

5.1.5.1 Impact des blocs try/ catch qui ne génèrent pas d’exceptions
`
 . @  ï "
 Y€ "?!  Y N  , TZ  #
&:  U
 ",Ú >_,›", 5"$Y N  =>=# "H .! g
U  
 >=.)*( "? ÚV=.Ü,V  Z
 =) ",  ] I  r",.#T"? h .U=>=) *(  ïî
v
 )*+ > 5gL# .

 #L  l#  
 > 5R g . H 5D=h=#
"B  l1b!"ɐ‚$
 . ö p
l 

#*1 <#4   (4  ]
#(b! ] h=.*( "?(ðf

 Z
v .
J‡S . , ",*4#P 
/    
.Rb † Ñ;&+  S h=.)*( "? DN 
G
 "D", ."!$¡ >_G
 "? P9
 N  ! . ) 
N 
   " 4] 
"\"? 
BN 
1
 "^", ."$H›5 >_ @ 
H?]  
 1", h .;*+d*+; " I
 ó = ë çžç èKõÀõ:ÿï[üFäèXépç?'ÀÿDë ý®íKÿ#íKõéf±s²&œ
F
û û
hFó = ë çžõépèXé0ë çìXå3ë ký®èjë æFøÈî#éðï0ë æAñAuB3èï^ñKõÀù
û
ë æ¶é th³)t( ˆ ÿ-ökø^èï^ñKõ íjæAñXéTÌ ' ö¸öF ù0´       */
. û

‰ æ¶épíKñ íï A èï^õÀí‰ æ¶éðø^èï^ñKõ?þ A pB ùú


=›[l íKçéJAuþ B À> üÑ o ö+  æAíX÷”‰ æ¶épí ñKíï0øHF# ù æAíX÷”‰ æ¶épí ñKíïÈø   ù æAíF÷
p


p
‰ æ¶épíKñ íïÈø F3 ù ú?X= åKå íKè3æÌï^íKõKú
­  û
å3æXñ®éÈë ý®íkö¸î#üXõépíý çXóKïÈï^í3æÀépÿDë ý®íÌë ë õXø3ùú
û ûû
ï^íKõ®ö®éðï[ü çÀèXépç?' ë æ å þ åF  ø th³)t( ˆ ÿ À> üAo ùú
û .
î#üXõépíý å3  óÀé F ï,ë æ¶ é æF øð éðï[ü®çÀèXépç Ì ' ë æ å på:  é^åKån- øÈî#üXõépíý çFóKïÈï^í3æ¶é[ÿDë ý®í}ë ë õXø3ù éÈë ý®íKùÈùú
û û  ûû W
éÈë ý®íkö¸î#üXõépíý çXóKïÈï^íjæ¶é[ÿDë ý®íÌë ë õXø3ùú
þ þ þ
ûû
ï^íKõ®ö®éðï[ü çÀèXépç?' þ æAåXé ë æ åKåK  ø t©³t( ˆ ÿ À> üAo ùú
û .
î#üXõépíý å3  óÀé F ï,ë æ¶ é æFøð  éðï[ü® çÀèXépç Ì ' æAåXé#ë æ å åp :  é^åKån-
û û 
øðî#üXõépíý çXóKïÈï^í3æ¶é[ÿ(ë ý®íÌë ë õXø3ù éÈë ý®íKùÈùú
þ þ
ûû
  íX íKèXéKþ éTA' í®é[÷Nå®é^íKõépõžõÀíXìXíï^è W ýÑåï^í®éÈë ý®íKõÌë æ:éTK' ë õ®ýÑíXéJ'Xå 
. û
  ôpåï3çÀå3æAõFë õépíjæAçü®ç?A' íKç%An ë æAñ

 ó = ë çžõépèXé0ë ç+A= å å í è3æ:éðï[ü çÀèFépç?' æAåXé ë æ åKåF ø,ë æ¶éjï^íA í èXé
F
û û û
=›[l íKçéJAu3B åKùH‰ æ¶é^íKñKíïlë AuS B ök  æXíF÷”‰  æ¶épí ñK íïTA  #,B ú p
éðï[üjôpåïSø0ë æ¶él3ökï^íAí èXé0ú›l} 3ú›l ù

Dë A BSö¸ø\‰ æÀépíKñ íï^ùSåA ø l ù\µ"%B,ú


WJW
0

ëA S B ö¸ø\‰ æÀépíKñ íï^ùSåA lHµ("%B0ú


ë A "%S B ö¸ø\‰ æÀépíKñ íï^ùSåA ø l K" ù\µ"%B,ú


 
ï^íXéðóKï0æ:ôpè õÀíjú çÀèXépç?Ì ' østX> çÀí¶é0ë å3æ®íKù/ï^íXéðóKï0æ:éðï0óXíjú
û  
 ó = ë çžõépèXé0ë ç+A= å å í è3æ:éðï[ü çÀèFépç?' ë æ å åF ø0ë æ¶éjï^íX íKèXé +=›l[í çéJAuBåKù
F
û û û
&‰ æ¶épíKñ íï#ë AuS B öyæAíX÷¶‰ æ¶épí ñKí ïTA #%,B ú   p
ôpåïSø0ë æ¶éj l ö¸ï^íX íKèXé0ú›l} 3 ú›l ù
WJW

201
Source: Jack Shirazi, Java Performance Tuning, 1st Edition September 2000 , ISBN: 0-596-00015-4, pages 496

©Kamal AOUDA 2005 www.kamalaouda.com Page 116 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

ðéðï[ü
ë A S B ö¸ø\‰ æÀépíKñ íï^ùSåA ø l ù\µ"%B,ú
0

ëA S B ö¸ø\‰ æÀépíKñ íï^ùSåA lHµ("%B0ú


ë A "%S B ö¸ø\‰ æÀépíKñ íï^ùSåA ø l "Kù\µ"%B,ú



çÀèXépç?Ñ ' østX> çÀí¶éÈë å3æíKù/ï^íXéÈóKï0æžéðïÈóXíjú
 
ï^íXéðóKï0æ:ôpè À õ íjú
û 
`
 +#  
 5 5^! .
!\?! 

 ( ( 5
  -0
0I

Tableau 22: Impact des blocs catch/try qui ne génèrent pas d’exception202

5.1.5.2 Impact des blocs try/ catch qui génèrent des exceptions
JK! . #*+! ?€;
 ",-", ."$,›5 h_4 ! -
4 1!
"H  ;
# "? ! .&
  4  ",(", . "$H›. #h_
@ 
fZ  <#! i € "??  :?! -   ?! 5T!
( T .*1:g# ?R#"? @  N   

 ] !  =h=) "$  ;*+ ?? Z4N )# "!#
4
!+ ( #."?
  Q
  I

a#  < .… F . , ‚=>=# "H  F
 a!
"H  7I.3 I 7I.3  @  N a N 

! .…
 @  N  
Z  <#
 a€ "?!  F[!  ! ‡  .*1Fq# ?c 
 ) 
.a÷c9R3,2[=. F9"??€[q 
!
"H  1
#
"? ! .I 
 ]
 ."? +   .  &   (
.
Z.*1*+ .\
 ] ? . 
 #4(, #) "H
v
*1 
 *1
*î *1 #…c
 ",F", ."$H›. #>_c  " 
[ 
Ê",
:~#…#< Z …Z
 .  =.!

# =# #  +
 ",=."B 5) ! H6׏”Eœ?€4
 ",+  ]
   H6׏ž'ƒŽI

5.1.6 Casting
`
 U .  UW  5ç”",
,  ZÈ g±??ç”"H
,  ZX! ¡
W *1"B ‹ #
"H g  l  
`
 >=.)*( "? \ ^

  ",  
I 4Z.]
 . 44"? - *1"H 5]) s
  @    1",
H  Z1!-=5
?!14*(
4",*1
    (+4*(
4€
"?  I

  @  : …",
,  Z5 .[  K / Ÿ# 5/F a
) *1  ]   & a ! .h=.", /

 -" 
?! \", "#< .  I

202
Source: idem.
203
Blocs partagés par plusieurs méthodes.
204
Autant de blocs catch/try qu’il y a de méthodes.

©Kamal AOUDA 2005 www.kamalaouda.com Page 117 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

ef1#< Z 4Z  . s


`
 :",
,  Z
 @ 
œ!:=.! r*(
T€
"?  ?! ^*( q h=.*(! > @  g  

",
,  Z
-4*(
4",*1
    I
`
1",
,  Z4 + ) *1  ]  \ , 
 + >=.)*(? @  +"? 
B \ Ÿ# 5 I
• `
1",
,  Z4 + ? .h=."? \ *( ( h=.*(! @  4"? 
B -" 
?! -", "!#< . 
I

8 R! #R=."H .  @ 


A ! +
Z
Z. ]   N  *1"H +D",
,  Zl 
   D >=.*( "? g , ; 
‡

. =. T î#   !ÚN $ ) 5
Z @ 
/€
 , .! T! #±  V" 
?!  Icefî=>=# ‹
 
 N )# !"? "?F " 
?!  , K
. =.a K
  a",
,  Zc*+  .*1!9a!…#   !×I
JK*1! .a .
F…"? a *4"H 5
&f  a
.
Z.*4*+
5/
 ] ! Kd #:
#
" /
a …"$ €F 
h_
  TN  Ÿ# 5T -
 ] ? ( ]
 .1  r", ,  Z
TN   r",
 ?!! \9S N  ] ",l g h_
 R 
`
 Ÿ# 5; #. . /K 
 
  ",  F~)‚€ *1
 F  F"#
K
  , !
, 5
"ÉHK

!*1
 F"$,'   F",."H .<# œ ) Z…  / ?] ! #   !  Z
 / *15 5? 5
`
!    ?! < + + >  \ Ÿ# 5\œ ) Z  , >ƒŽI

5.1.7 Passage des paramètres, propriétés statiques, propriétés d’instances


Ò   @  ?  
*1 .F  
œ h_
 a [
??
Z
 /.*+< ##    ",! @   "? 
(

   \ 
  + h=.*- "? 
I
Ì ?" [  Ÿ# ”&f  a.*+< #.  Ê  a .
) . F ",  H6׏)oi?! Ê  
") >a   ",
…
 
.
 *+! @     + .
 . \, 5  @   -   +
.
) . \N  , 5 "? (~) . ?+ @     
.*+< # 4 œ    .
) .   ",  +?! , 5"!ÉH 4
 
 ;ö! /
  .
 N "?"?< \

 ]  (  
   ƒŽI
â‚ 5!-?=)  @     (
. ) . \N  , 5 "?4"?"
 ?    ",
1
 \
*+ *( # @  ;  +
. ) 5 \, 5  @   
I

5.1.8 Fichiers JAR


j“ , ‡ 5 Ÿ.
.c
# !=# .
 :T# Z.
 i  [" 
?! aN 
 :

  ",  …a =) "$
 .
b Ì L ]! A‹ T 
  _ ×Iè(? #‹ g#  "B  :c . =) "[ 
\ ‹# ! &‡ r",*1
# ?  
 )*+ 
 1 , #) 
!  ;
 ^=."  1 N 

  ",  I J‡ ; ”&
 ! +=.! 
4!;
 4
 "?

T*1
# #.  ] qT" 
?! …

T*+d*+:=) "$
 Ab Ì LT)  @  qN "?".,) ##‹ 
.*1(
"? ?? #   

",*1
# ?  I

205
C’est à dire les propriétés temporaires qui sont créées à l’intérieur des méthodes.

©Kamal AOUDA 2005 www.kamalaouda.com Page 118 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

fe -]
 1
.=) .•
   *+!  - ]? 5
Z - i=) "$
 .\b Ì p&  Í=.. @    (" 
?! 
? ! •",*1
# ??
 4
!  *+d*+ .#/ 
•"$.Z*+? f N 

  ",   ~..# @ 

 ! d #4",

+(€
"!! 5!  N 

  ",  ( ] 
"( N !  Ì
 ã ] )
! ƒ

5.1.9 Caching des applets


`
 .*1šî . 
"$.Z
*+! T H ‹ N 
ô î
  " ?ە
.
 <*+ ÚY >=.)*( "?
î
# ",! ## / ] 
"F  /

  5
I•è(? #:   .
"$

 @   /…",*1
# ?  …
# !! .
 /
a 
!
"H  r
# "? ! .&Ê g*1 !rq",
"$ T c
   5cr
 ]  "  ! ",! #) 
 T9R 
# ? !  (4"?  .
 <*(I
J  > .q*1 !c","$ T ! pd ##:Z #
c! 5*(  @  *+! i  [
"! Fb? ]  Z
çñ …
‡
v
",

…K …
.
Z.*4*+
‚
/ N 

  
  _ K~#"Í=×I 5
Z
/ ?=.
ƒ'I 
K #[> ”&
v
#
",*4*(
1"? > .?€
 <*+ .)  ] ."? @  N   F )*+ N  ] 
 4",! .Á 
 
 L ."? ? gSZ ,  ¡P",
"$ SS
 ]  ¡P ]
 Z
 . ~) 5 @  N  ] 
"¡ 

#*1 <# .)  ] &  ]
 Z
 .
 !  


) *(  4

  54 ","$ F
=. #
 "?
91 =) "$
 .] 
*1  ,€ƒŽI


»
²\º1£.¦¹!¬.©¤º¨ £³£
»©à ³¦¹
¤·,¦«!¬#¤J·¨ ©¤¨ £1»
© ²,¬¸ ¦«(¥¹+·,£·Ä ©/Ö
ê1ß
Ïè+Ob
eœJð…I>IhI>I Ñ
`
Ï Ì  Ì ÑGâ Ì Ñ1e¥^¦”#"$
 ] I¦ †fÌ Ê 8 e¥¦ŽIhI>I ¦Ñ
v
IhI>IhI
`
Ï Ì  Ì G
Ñ â Ì 1Ñ e¥^¦×","$%k
!  "¦ †fÌ 8Êe¥^¦‰IhI>I ¦Ñ
v `
Ï Ì  Ì G Ñ â Ì 1Ñ e¥^¦×","$%k
#"$
 ] I¦ †fÌ 8Êe¥¦‰IhIhI ¦Ñ
v `
Ï Ì  Ì ÑLâ Ì Ñ1e ¥¦×","$ -k ] .  "¦ †fÌ 8Êe¥¦‰IhIhI ¦Ñ
v
Ï ›#è+Ob
eœJ ð Ñ
`
N  > ) 
! ","$ %k
?  1!  ##; N 
 4 i . i] 
.^ 
 ]! .  s

â /s  N 

   N  H ,Ÿ.*( (*1 !1(","$ I ef  4 ,
5 Ÿ.
.i . 
"$.Z
+9 5  
‚

!>] 
”I
Of.’!×s  N 

   H € "! .
49 >  +","$ +1
.’!~5!  1 !=5! 5ƒ'I

 Z s  N 

   , €
"? .
49 >  (","$ +4
 Z
çñ 
• v .

©Kamal AOUDA 2005 www.kamalaouda.com Page 119 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
N  > ) 
! Ê","$ %k
#"$
 ] q
p?r5 Ê",!  ! A r  , .: =) "$
 .b Ì P c ",
aË
 N 

   , ",*1 # ?!
I e€ *1
 4N !    ?  s
`
Ï Ì  Ì ÑLâ Ì Ñ1e ¥¦×","$ -k
#"$
 ] I¦ †fÌ Ê 8 e¥¦”I Ÿ.×& I Ÿ.×& " I Ÿ.D¦ºÑ
v
`
*1 !+9Ÿ.
  N 

  
 "?
4
( 1","$ +  1 . @  s
` `
+] 
E¦ 
, >ç'Ñ-
 =)  ^¦+","$ %k
#"$
 ]  
 "? + 
 4!>] 
 , 
 (# "?! .

@  1"?  4+","$ -k
#"$
 ]  
 "? 4
( 1","$ I
` `
S] 

 ¦ñJK! .? 5ç !Z "$ ¦l","$ % k
#"$
 ] L
 "? P 
/ S!>]   H 
 !

#
"?! . @  1",  4+","!$ % k
#"$
 ]  
 "? +
+ 4","$ I
` `
“j ? , • *1> 5!  . @   
, 5çñÑ-
 =)   JK! .! >ç Z $  # 5
) ! •
\ 5 Ÿ.
.
 #  
 5 5F=) 
   5 @  ‹ r",*4*1

 ",  c! #‹ q"  !  i q!>]
!c=. ‡]
 
`
òðð Q~)!    ?  r
5 5", r ƒŽI  ^ ]
 5^"?g
.
 <*+g =.! ^?    !- N  > ) 
!
v v
","$ % k ] .   @ 
!
??"  (] .  4 ","$ %k
#"$
 ] 
*1 ?€;Z # 
*1 !9
Ÿ.
×I

5.2 Optimisation des principaux composants J2EE

5.2.1 Optimisation des servlets et des JSP

5.2.1.1 Se méfier des objets PrintWriter


8‡  1#
5-=)# @  *1*+? •",*4*1 ! 4
; ",


Z +!h]
  54"H  , .9F?    !
`
 l*+ $
¡
) !  
~5ƒ4¡ N  Ÿ# ) ! hõT) .4 -Z  #4 R",! .
DòðfÑ  ,   g
v

.’!R~#"Í=×I…" 
?!îõq) .'3BƒŽI Ì ] 
"U
 Y",, 6׏)tu& È*+  $
X ) !   ~.ƒD"#
W

`
! . . Ê
=>=) "$ ‡  F#  
 5 5  Ê
 c?]   c  Z I Ì ] 
"  FZ aòðÑ "?
! . . f H  5? •  *1
 *+!  Z# F#"? @   F
.’!‚ N  ! .) #< . @  F    ! 
`
òðÑ I
4-5 7 889+R¸GsI E9G…:
Fó = ë çžç èKõÀõ-C€ï0ë épíï í%>Àépí3æ% õé éJXîDíï[ì íXé …Kó = ë çìXå3ë  å ¹:íXéjøsé éJFîíï[ì íXé í óXíKõéjïðí
û û
û û û .
 é éJXîDíï[ì íXé íKõ?Aå3æAõÀíkï^íKõÀù3éJ'Fï^åX÷Nõîíï[ì íXéTt>XçÀíÀéÈë åjæ ‰ t>XçÀí¶éÈë å3æ1
 p
û . û
ï^íKõ õÀíXé^äå3æ¶épíjæ¶é[ÿjü A  íøHð épí%À> é JÀ' éÈý 0 ùú p
û
³ þ ï0ë æ¶ém€
 C ï0ë épíïjåóÀéSö¸ï^íKõ ñ íXém€ C ï0ë épíïÈø^ùú
å3óÀé F  ï,ë æ¶é æFø À' éðý } þ0 ùúÀå3óÀé F ï0ë æ¶é æFø A' í è } éÈë é í}(í å+Cåï  [éÈë é í} J 'Aí è } 0ùú
þ
û  û
þ
û   û ûû û  û 

206
Ecran MS-DOS

©Kamal AOUDA 2005 www.kamalaouda.com Page 120 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

å3óÀé F  ï,ë æ¶é Fæ ø = å Xü } 0ùúô^åïSø0ë æ¶é#ë¶ö kúKë


X 3úKë  ù #å3óÀé Fï0ë æ¶é æFø ' } í + å Cåï  T ' } 0ùú
û  
 û 
ûû û


å3óÀé Fï,ë æ¶é æFø 
þ T=Aå Xü } T'Àéðý } 0ùú þ
û   û J
þ

fe D!    ?! -‹=.Ü,¡  .#"$Z 


 l  g*+ $!
 g
) !  
~.ƒ; 4
) ! #~.ƒ4‹!  ! 4  
*+d*+ /#  
 5 5*( !
 …*+d*+[
 ]  /…>=.)*( "?Iœef =.   #5 .*+! fN 
 
*+ $
š
) ?  
~#œ #) ZM?ƒc @ 
 ]! FL .*+ Pš >=.*( "?ÐL 5 .*+! š 
*+ $
+ 
 ]! .s
Fó = ë çìXå3ë (Fï,ë æ¶é F æ øðî#éðï,ë æAñ}õÀùhFï0ë æ¶éðø^õÀùú?Fï0ë æ¶é æFø^ùú
û û û 
`
c*+ $
…
) !   ~.ƒ=. f
 /)) <#F
 9c c*+ $
…
) ! ~5ƒ @ 

9a? 5
‚

#   !‚ ",?] .  1] . =.*( f 
" =) [‡ c*+  $
F! #JK! 5! >ð_
 ~5ƒ‡… 
" 
?!Rò >  >]
  )  !I‡J‡ c",?] 5  c,! p #< c",Ï! .!! :q*+ *( #T 

."? ?! p
K  =.*( 5/",*4*+: N 

 ",
I 
‡"? h .:. ?… 
=.?  ?? _ K

v
5! .D D*+  
#rg
,  
 ‹‹ 
,   ^ : Ÿ# 5q",*4*+g>]
  5è-! 
! .œ ## *W9
 N  Ÿ# ) ! hõT) .‡~)
!€*1
 F 
"?FZ #F 
,  ?   , 

 
 a!
"H  
v
7I 0I.3I ƒ'I
­
J‡ 1   \!>]
  >+ 4,! 
\?  *1 !
 (
 *1
 *+! 5 ;","$ 4
 
# !? 5  I
JK*1*+gq N  ][] 
q R5   &K   c?! \
 :=>=) " ! . q . @  N    c?!
­
!    !
 ;€ "   ] *+! •
 N  *1
 *+! 5   ",! .Á 
”I Ì "$ @   =.  @  /"?  ,

?  
 &- K=.! 1 ]
" 1 g!>]
  5B6׏” 5?  S"H
 @ 
p",! ) 
 l # "H 5*+! 49G 
Z  .  ;  ]
 I Ì ! #*+! )  @  "# • 1",

 
Z  @ 
  ?] ! N  ] #
=. 5?  4

 ; N 

  ",  +",*4*+  ;*(? .  +=) Z
# ‘I
­
5.2.1.2 Eviter l’implémentation de l’interface SingleThreadModel
J *1*+cF N  ] Ÿ.9…€

  @  a
F  F.   0… &œ [",! .  "#
c
Ê  
K
­
" 
?!  @ 

 *1
 *+! .?  N  ! .>=."?/ Z  ðf$
#  Ñ-
! 5? •N  , 5 ", 1F /!>]
 
@  N  ,_;# @  d . 4! #.! . -] .; N 

  ",  IJ‡  =>=#
"B .1!
 *(! f  @ ?  .
 *+ *( #+  
 
  
 N 

  ",  1*( \ Z  *+!   i #. .*+! 5-.  <  
I
efQ#< Z CZ  . M =.! / ]
 ./N  *1
 *+? ./"? > .M ! .>=."?M aM
P 

 !
 
!   *+! K  # ??
#", /!>]  ×Iœj“=.. 
 ! 5Á ? .‡ ‡ [" 
,!cò >  >]
 
#"? @  N 
 g!
 ¡ , > "?gR"? h .R" 
?!r #5 .‹ 5? . ‹  ‹# @  d . r
. ] ! ^
"  ! ~#1=.  /",! . 
œ > #) 
 F
 !


."? ? 19a /!>]
  *( ;"#
9a N  ! . ) 

1"?  ."? ? ^? 5!
+ $ # 

 @  N   _(4;# @  d . ?ƒ'I

207
Typiquement System.out.print() ou println()

©Kamal AOUDA 2005 www.kamalaouda.com Page 121 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

208
Figure 47: Impact de la méthode println() sur le débit d’une servlet

5.2.1.3 Implémenter un filtre de cache


JK*1*+T: N  ]]
…
: ‹5   &  {  ..: ! 5#"?? .! pc*-! ‡ 5! . c  
­
# @  d . /! #.! .  ] .F N 

  ",  a  ]
.! . F  F# ! ?5 >! ‚["?   ç”" I
J‡ > .     1 ! .)*+   #    @   =)   ?Ÿ. 
4.Á 1" 4
( 1Z H  (+","$ I
k‚a"? > .>  q[
# !! ..…
…!€ *1
  @ 
•*(! ##:",*4*+! A *1
 *+! 5 
Z ,  gR","$ D¡
 ]  gN 
l{  .;~J‚=”I" 
?!lJK"$ {  ..ƒ'IiJ‡ (€ *1
 Dl .
 
   *+! r


  î
 ô Y  ]
#sa>]
  5šîb! ]>]  
Z # ªqs/ðf$ ôb!0e e ª
v
ð•
"$
 
Z _\õ\ðf ×I

465 7 889 4‚7 a%b%9ºI 5 Ef9GJ»\¼\†


AèKç%nèKñKíÌçÀå3ý l[õ? =AåKånXú
ë ý X  åï[épl èXìXè ë å þ ú
ë ý X  åï[épl èXìXè%> þ õÀþ í½ ï[ì íXé ú
û
ë ý X  åï[épl èXìXè%> þ õÀíï[ì íXé þ ½ 'Àé éJ ú
û
ë ý X  åï[épl èXìXè óÀþ é0ë äè í3þ æ%K èï,þ ú½
û û
Fó = ë çžç èKõÀõþ äèKþ ç?X' íj° ë épíïlë ý í3ý®í3æ¶épõ°Së ^é íï,îíï[ì íXé^äåjæÀépí%>ÀéõÀçKú
û û û û û û
° ë é^íïðäå3æÀôÈë ñÑôpçKú
j
û

208
Source: Harvey W. Gunther, WebSphere Application Server Development Best Practices for Performance and
Scalability, IBM White Papers, September 7, 2000
209
Source: By Jayson Falkner, Kevin Jones, Servlets and JavaServer Pages™: The J2EE™ Technology Web Tier,
Addison Wesley, September 19, 2003, ISBN: 0-321-13649-7, pages 784

©Kamal AOUDA 2005 www.kamalaouda.com Page 122 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

åjæAñÌçÀèKç?'AíFÿ(ë ýÑíKåóÀéSö*£Aå3æXñ 1ˆh¾ ˆ‚£ ¦—tDú


û ™
Fó = ë çìXå3ë  å°jë pé íïÈøðîDíï[ì íXé  éjï^í
þ í óFíKõ
û û û .
îíï[ì íXé íKõ?Xå3æAõÀí¸ï^íKõ p
û .
°jë épíïð6 ä 'Xè3ë æ®?ç 'Aè3ë æAù p
û
éJ'FïðåX÷N õ ‰ +t>XçÀ í ¶é0ë åjæ îDí3ï[ì íXTé t>XçÀí¶é0ë å3æ
û
é Jé Fîíï[ì íXé í óXíKõéjïðp í óFíKõéjö
û .
sø é Té XîDíï[ì íXé í óFíKõépùlï^ í jú
û .
é Jé Fîíï[ì íXé íK?õ Xå3æAõÀí¸ï^íK õ Aå3æAõÀíkö
û .
sø é Té XîDíï[ì íXé íK?õ Aå3æAõÀí ùlï^íKõKú
û .
 ?ç 'AíK%ç në ôK÷NèKõžèkï^íKõÀåóKï^çAí®Jé 'AèFé?õ 'Aåó j%æ   é =XíÌçÀèKç?'Aí 
û
î#éðï,ë æAñ¸ï#öÌõÀç ñKíFé íKè ³#èXJé 'Kø T0ùú þ
. û
î#éðï,ë æA* ñ AèXTé 'Ìö þ

ôpç ñKíXés‰ æKë éT³#èï^è3ý®íXé^íïÈøÈï^í óXíKõé ñ íXé í óXíKõéT¦ ‰ ø^ùÈùú


. .
ë ôjøsAèXþ éJ'q öyæFó AèXTé ' í 3óXè õXø þ æAåKçÀèKç?'Aí 0ùÈù
û ûd¿h¿ û
ç?'Aèjë æ Kå°jë épíïÈøÈï^í 3óXíKõþ é ïðíKõ?Aå3æAõÀíKùú
û
ï^íXéÈóKï0æ þ ú p

AèXéT'Ìö¸ï A èXéJ'ú

î#éðï,ë æAñyë k  ö¸ï^í óXíKõé ñKíXé í óXíKõéT¦ ‰ ø^ù
. . 
ï^í óXíKõé ñKíXé À óFíï[þ üFî#éðï0ë æXñø^ùú
° ë í®é^íý 
j  þ ë ï#ö¸øsj° ë íKùÈõÀç ñKíXé D ˆ é éðï,ë =FóAépíø
û û
 [l èXìXè%> õÀíï[ì íXé çÀå3æ¶é^í%À> é épí3ý j ë ï0 ùú þ
û
  ñ íXéX åKþ õÀõFë = íÌçÀþ èKç?A' í þ
û
î#éðï,ë æAñÑépíýÌ  ö®épí3ý  |  ë ï ñKíFé ˆ‚A= õÀå óÀépí# ³ èFéJ'Fø^ùú
û
° ë í®ô0ë í¸öyæAíX÷”j° ë íø[épí3ý  ë K ùú
j þ
û û û 
  ñ íXéçXóKïÈï^í3æ¶éSï^íKõÀåóKï^çÀí
ë ôjøsA  èXéJÌ ' ö3ökæKó ùŸX èXéJÌ ' ö}õÀç ñKíXé íKè l ³ èXéJF' øÈï^í 3óXíKõé ñ íXé í óFíKõéT¦ ‰ ø^ùÈùú
ûû . û . . 
° ë íÌçXóKïÈï^í3æ¶éSöyæAíX÷S
j ° ë íøTX èXéJA' ùú þ þ
û û
éðï[ü åjæAñkæXåX÷ˆö
û
ä|è í3æ èï ñKíXé\‰ æAõépè3æAçÀíøðù ñKíXé[ÿDë ý®í‰ æ Ìë ë õXø^ùú
û ûû
 p õÀíXé éÈë ý®íKõépþ è3ý   ç?A' íKç%n þ
ë ôjøsq ôÈë í í%> ë õépõXø^ù)Á À Á ø[ôÈë í í%> ë õépõXø^ù
û û ¿h¿
çXóKïÈï^í3æ¶é èKõéJ®å 3
þ  ë ôÈë í þ  ø^ùF® } ô0ë í èKõéJå j  ë ô0ë í  ø^ùÈù)Á Á
û û û
çÀèKç?A ' íFÿDë ý®íKå3óÀé æXåX÷ ôÈë í èKõéJå 3 ë ô0ë í  ø^ùÈù
þ þ
 W = õÀå û óÀþ û épí#
î#éðï0ë æAñkæXèýÑí¸öÑôÈë í ñKíXémˆ‚A ³ èXéTF' ø^ùú
û û
æAèýÑíkö þ

æXèý®í õXó=Aõéðï0ë æXñøH æXèý®í èKõés‰ æ%Kí%>?NôðøH0ùÈùú


û
æAíX÷°Së  í þ ø0æAèýÑíKù  ý ndjp ë ï^õXø^ùú þ
û
þ

©Kamal AOUDA 2005 www.kamalaouda.com Page 123 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

òjüÀépí?ˆïÈï^èXü?óÀéJFóÀéðî#éðï^íKè3ýÂ=Aè åKõ®ö

æXíX÷ˆòjüÀé^í%ˆïÈï^èXü?óÀéJKóÀé^î#éðï^í èýÌø^ùú

ä|èKç?'Aí íKõ?Aå3æAõÀí?C€ï^è Aíï ÷:ï^è Aí  íKõ?A åjæAõÀí¸ö


. .
æAíX÷ÕäèKç?'Aí íKõ?AåjæAõÀí%C€ï^è AíïÈøÈï^íKõ?A  å3æAõAí =XèKåKõÀùú
.
ç?'Xè3ë æ Kå°Së é^íïÈøÈï^í ÷:ï^è Aí  íKõ?A  åjæAõÀíKùú p
û .
°Së í óÀþ éJKóÀé^î#éðïðíKèý‚p ôpåKõÑökæXíX÷j° ë í   óÀéTF óÀéðî#éðï^í èýÌø[ôÈë íKùú
û û û
ô^åKõ ÷:ï0ë é^íøT=AèKåKõ é^å3òjüÀépí?| ˆ ïÈï^èXüKø^ùÈùú
ô^åKõ þ ô óXõ?F ' ø^ùú þ
û
ô^åKõ þ ç åKõÀíø^ùú çÀèXépç?Ñ ' øðîDíï[ì íXéTtX> çÀíÀ éÈë åjæíKù
û J û
ë ôjøsq ôÈë í í%> ë õépõXø^ùÈù
þ
û
éTF ' ï^åX÷‚ þ æAíX÷Õîíï[ì íFéTtX > çAí¶ éÈë å3æFø^íKùú
û J
çÀèXépç?Ñ ' ø\‰ +tX> çÀí¶ é0ë åjæíKù
ë ôjøsq ôÈë í í%> ë õépõXø^ùÈù
û
éTF ' ï^åX÷‹þ íjú
J
° ë í‰ æ F óÀéðî#éðï^íKè3ýˆô0ë õ®öyæAíF÷j° ë í‰ æ K óÀéðî#éðï^íKè3ýÌø[ôÈë íKùú
j
û û û
î#éðï,ë æAñkýžéSöÌõÀç ñKíXéTÌë ý®íFÿSü A  íøÈï^í óXíKõé ñKíXé í óFíKõéT¦ ‰ ø^ùÈùú
. .
ï^íKõ?A  å3æAõÀí õÀíXé^äþ åjæ¶épíjæ¶é[ÿjü X íøÈýžépùú þ

îDíï[ì íXé  óÀþ éTF óÀéðî#éðï^íKè3ý†õÀå õ®ö¸ï^íKõ ñKíXé®  óÀéJF óAé^î#éðï^í èýÌø^ùú
û
ôpåïSø0ë æ¶éSë¶öÑôÈë õ ï^íKè   ø^ùúFë q ö úFë¶ö®ô0ë õ ï^íKè  ø^ùÈù
þ

õÀåKõ ÷:ï0ë é^íøÈøT¶ = þ üÀépíKù/ë ùú W


þ
J
Fó = ë çþ ìXåjë y  ë æ ë éðøsj° ë épíïðäåjæ¶ôÈë ñ®ôÈë épíïðäåjæ¶ô0ë ñKù
û û û
éJ' ë õ ôpç®ö®ô0ë épíïðäåjæ¶ôÈë ñjú
û
þ ñÌçéSö
î#éðï,ë æA

ôpç ñKíXés‰ æKë éT³#èï^è3ý®íXé^íïÈø0çÀèKç?'AíFÿDë ý®íKå3óÀéf0ùú

ë ôjø^çé0þ q öyæFó ù


ûû
çÀèKç?'AíFÿ(ë ýÑíKåóÀéSö 
   £AåjæAñ Aèï^õÀí£Xå3æAñø^çépùú

­ 
éJ' ë õ õÀç®ö®ôÈë épíïðä|å3æ¶ô0ë ñ ñKíXéðîDíï[½ ì íXé^äåj
½ þ æ¶épí%>Àéðø^ùú
û û 
Fó = ë ç þ ìXåjë  KíKõéðï^åXüKø^ùðþ éJK' ë õ õÀç®ökæFó ú¶éJK' ë õ ôpçÑökæKó ú
û ûû û û J
þ þ
`
 =)  #/ *1
 *+? .  /" 
?!/JK"$ {  .f ? N 

  @  •9 N  *1> . @    !>]
 
;
¡b C N 
  ",  I Ì 5   C N 8Êpj\C Q# @  d .G ; S.*+< ##  @  N   
v
. 5 .&i K",, )
 4 D !  =) ! 4

 @  l
1# =# # "?1  qb ›#!>]
  5T
g 
v
","$ s
œ ) Z 
 ¥# @   , )I Z ) @   , )8Êpj“~5ºƒ # @   , )I Z 5Ò( >_ • ) Z~5¨ƒ §

©Kamal AOUDA 2005 www.kamalaouda.com Page 124 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 
#*1 /.*+< ##l #. > . C Q# @  d 5C )*+ ;N   @    ^ Pb ›#!>]
 
C
v
*(
g ! id ##g*1 !rq","$ I i =.? A 5! . q  …b ›#!>]
  >q ?] ! id #
v v
*1 ! :q","$ T??=i œ"?g.*+< #r H i Z
œ 9 Å ","$ N IK• .f , \ r",

&Ê =)  #
 ! .).*1! ?L
"H  ]
 . Q a
?!M š*- L9š ì
."$  M# ?? #"?Q
ì N 

  ",  
~.!>]
  )&?! ##-=)  #•Ýƒ
 ç?'AíKç%në ôK÷èKõžè¸ï^íKõÀåóKï^çÀíÑéT'AèXéõ?'Aå3ó 3æ% é0=AíÌçÀèKç?'Aí 
û
î#éðï0ë æXñ(X  èXéJÌ
' ö®ôpç ñ íXés‰ æ ë éT#
³ èï^è3ý®íXépíïÈøÈï^í 3óXíKõé ñ íXé í óXíKþ õés¦ ‰ ø^ùÈùú
. .
ë ôjøTA
 èXéT' q ökæFó  èXéJ' í óFè õXø æAåKçÀèKç?X' í 0 ùÈùþ 0 ç?A' èjë æ  åj
þ X ° ë é^íïÈøÈï^í óXíKõé ï^íKõ?Xå3æAõÀíKùú
û ûd¿)¿ û û
ï^íXéðóKï0æ ú þ þ p
}

 …b ›#!>]


  *(!
A # @  d . ? Kd .:*1 !ca","$ &f {  #a] ) =) … 
v
  Fa ͟.9[ . …*1 !a","$ I . , K a",
 c{  #/] ) =) F  a
 .… a)
 <#
*(
 =) ",  a …b ›#?>]
  ‡ H p
H . ) 
#…9c"?  …[","$ Iœ"!N  , Ê c",
[ a=)  .
v
*+ œ","$ F a?]    ] .   F b ›#!h]
  •  / # /"  ! •9a5  œ
v
","$ I
k‚; /# , .  4",
 & 1=)  #/
?!/ *( 1?€4! # 1# ??
."? +/ N 

  ",  

 
 ! .#"?! .˜ –# !˜
M ™*+ h #ÓÔ","$ ¿
— ™#  > > #— .*1. #
`
Ÿ. ] €I !>]
  ”I ",? .€! )I .*4 Ê ]! ‡q N ?] _ Ê…"  ! ”I c 
Z.*1*+…c! @   "?
  +=) Z
#4Î
÷;~)>   ƒf   , #1"? ^ =h=# #? 5-", ^(=) Z
#I
­
`
 .
"$

 @  [ # !! .
-Ÿ) @  N  "*+ /","$ a   


  F
 ]  !>]  ×I•8‡ 
! #D .
"$

 @   @ 
 *+ 4P> 5
Z R=..
 D ] 
"D S"  ! 1", , .l9S . #

 N ! .d .…JK"$  ç×JK! #. F @   5F$? > [ 5

 [ ]
 Z
 . a",!>] Ê  



 \
^?1 .
.1","$ ;~>] " 
?! !ò 
”{  ..ƒ'I

a%5 7 88 š 9 8?^QK89P)9 7 U 9GsºI 5 Ef9G


AèKç%nèKñKíÌçÀå3ý l[õ? =AåKånXú ±&œ²
ë ý X  åï[épl èXìXè ë å þ ú
ë ý X  åï[épl èXìXè%> þ õÀþ í½ ï[ì íXé ú
û
ë ý X  åï[épl èXìXè%> þ õÀíï[ì íXé þ ½ 'Àé éJ ú
û
ë ý X  åï[épl èXìXè óÀþ é0ë ú þ þ½
û
þ þ½

210
Source: Jayson Falkner, Another Java Servlet Filter Most Web Applications Should Have, Client-Side Cache Control,
http://www.onjava.com/pub/a/onjava/2004/03/03/filters.html

©Kamal AOUDA 2005 www.kamalaouda.com Page 125 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Fó = ë çžç èKõÀõ íKõ?Xå3æAõÀí íKè Kíïs°jë épíï#ë ý  íýÑí3æ¶épõ°jë épíï


û û . û û û
°jë é^íïðäå3æÀôÈë ñÑôpçKú
û
 ó = ë çìXåjë  Kå°jë épíïÈøðîDíï[ì íFé í óFíKõéjï^í
F
û û û .
îíï[ì íXé íKõ?X  å3æAõÀí¸ï^íKõ p
û .
° ë épíïðä6X' è3ë æ®ç?A' è3ë æAù
j p
û
éJ'Fï^åX÷Nõ ‰ t>XçÀí¶éÈë åjæ

îDíï[ì X í ést>XçÀí¶éÈë å3p æ


û
é éJFîíï[ì íXé íKõ?Xå3æAõÀí¸ï^íK õ Aå3æAõÀíkö
û .
øs  é éTX îíï[ì íXé íKõ?Xå3æAõÀíKùï^íKõKú
û .
  õÀíXé éJA' í*F ï^åXì ë  í *DÿSÿ)³zï^íKõ?Aå3æAõÀí(Xèï^èýÑíXépíï^õ
ôpåïSøsD t æFóKýÑíï^èXé0ë å3æ®íöFôpç ñKíFés‰ æKë éT³#èï^è3ý®íXé^íïsr(èýÑíKõXø^ùú
í A ' èKõ åï^ít í3ý®íjæ¶épõXþ ø^ùú ù
û
î#éðï0þ ë æXñ(A ' í è  íïs( r èýÑí¸ökøðî#éðï0ë æXñKùÈí æXí%À> éTt íýÑí3æ¶éðø^ùú
û
ï^íKõ?A  åjæAõÀí è    íKè  íïÈøTA' íKè K íïs r èþ ý®í
ôpç ñK þ íXé\‰ æKë éJl³ èï^èý®íFépíïÈøTA' íKè  íïs( r p èýÑíKùÈùú

 X èKõÀõéJA' í¸þ ï^í óXíKõé ð ïðíKõ?A åjæAõÀíÌå3æ
ç?A' èjë æ  åj° ë épíïÈøÈï^í ïðíKõ?A åjæAõÀíKùú
û 
Fó = ë çìXþ åjë y  ë æ ë éðøsj° ë épíp ïðäåjæ¶ôÈë ñ®ôÈë épíïðäåjæ¶ô0ë ñKù
û û û
éJ' ë õ ôpç®ö®ô0ë épíïðäåjæ¶ôÈë ñjú
û 
Fó = ë ç þ ìXåjë  K  íKõéðï^åXüKø^ùj éJK' ë õ ôpç®ökæKó ú
û û û J
þ
`
 =)  #… # !? . a" ç) ,  *+ fN  . #K N  *1> . @  ! .d .FF! @   K$! h I 

/
v
 . #‚"? 

"$.Z [ FZ ,  /","$ [ =.! "#
K
F*(

 Za! ##[ [.*+< #
JK"$  ç×JK! . &^ S$  

”â‚*+¡ 1  r


  @  N g?
$ .S*+ h #DR","$ IiJ‡
*(

 ZP
 ;d #P"#
lP
 ]  ¡R=) "$
 ;S 
  *+! (’iI €
*1~.
  _ *+!
 !") ! 55ƒŽI

ôÈë ^é íïJ}
û
< ô0ë é^íï æAèýÑí}
 û W
íK?õ AåjæAõÀí(í è Kíïs°jë ^é íï  ô0ë épíï æAè3ý®í}
. û  û W
ô0ë é^íï ç èKõÀõ%}
 û W û
çÀåý l[? õ  =Aå 
å n íK?
õ AåjæAõÀí íKè Kíïs°Së é^íï  ô0ë épíï ç Kè õÀõ%}
. û  û W û
ë æKë é Aèï^è
þ ý } þ

AèW ï^è3ýæAèýÑí}
 W Aèï^èý æAèý®í}
4‚7 a%b?9Ã\4ÄQKuEHGQ5 Å?Æ W
0ë æ ë é Aèï^è3ý}
 W

©Kamal AOUDA 2005 www.kamalaouda.com Page 126 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

 ôÈë é^íïJ}
 û
Èô ë pé íï ýÑè  ë æXñ}
 û W
ô0ë é^íï æAèýÑí}
 û W
íK?
õ AåjæAõÀ
í (í è Kíïs°jë ^é íï  ô0ë épíï æAè3ý®í}
. û  û W
óKï AèXé é^íï0? æ }? å ñKå KæAñ ÈóKï AèXé é^íï0æ?}+   çÀíXé3í%>Xíý  íkýÑíXé í åKñKå Kè3æAõ íÌçÀèKç?'Xí3óÑç ë í3æÀé
 ûW û  ûW û û û û û
 ôÈë é^íï ý®è   ë æXñ } þ þ
 û W

5.2.1.4 Gérer le cache via la méthode init() de la classe HttpServlet


`
 *+ $
D 
 ~.ƒ+¡ R" 
?!lò >  >]
  - H \ Z
 *+! +
Rr*1
 "?*+! (

l
 *1
 *+! .‚ /Z ,   ","$ IJK! . #*+? •9a a*+ $
!>]
 "?~5ƒ @ 
  , •
 

9¡"$ @  ‹=.  @  l D?>]
  +#
Ü, 4
 ¡# @  d 5RD#?] l
 ¡# !&i 
 ~5ƒ N  H

 
 @  N 
 q!
 :=. …
 T"B_ " qc]
 ‹ T!>]
  ”IKJ‡ g *+ pr# 
 #
",   .
 *+!   *1
#4(];
]
 ! ~).
!4 ) ƒ•? #  1"  !   4!>]
   . @  
  c# ! c# 5 )
 … "$Z! 
=# @ *1*+? ~. œ  c# ! c "$Z!
`
Ÿ.*( -   \
 ] ! d ##;)*( *+? , 5"!ÉH
 \ +
  
Z òðÑ H 5 # @   ƒŽI
`
N € *1
 V3P# Z  <#M ì# !C9Ð"$ @  G=.  @  M Ð!>]
  F#
Ü, F
 

?]    # @  d .I
`
N € *1
 ;0 Z  <# /# !
 ;!
 +=. (
1  "B_ " ;L]
 ; ;!>]
 



 l C
 "?S
l P"H"$ I+â‚ 5!l1   
. @  L N  Ÿ# ) ? hõT) .  ,
v
#*1
 "? R(
Tœ ) ZOf?=>=#( ^*+   #(  T >=.*( "? T~) (
 :
 5  \9;"?+  Ÿ# !;##49  1!
"B  +7I 0I.3 I.3BƒŽI

Ç x?9v^?5 9È:»É„\„$<
Fó = ë çìXå3ë ÌõÀíï[ì ë çÀíøsé éTXîíïpì íXé í óXíKõéjï^í   é[éJXîDíï[ì íFé íKõ?KæAõÀí¸ï^íKõÀù3éJ'FïðåX÷Nõ
û û . û .
îíï[ì íXést>XçÀí¶é0ë å3æ ‰ +t>XçÀí¶é0ë å3æ1 p
û
ï^íKõ õÀíXé^äå3æ¶épíjæ¶é[ÿjü p A  íøHpÊ épí%À> é T¶' éÈý ùú
ûË
³ ï0ë æ¶þ é[÷:ï0ë épíïjåóÀéSö¸ï^í ñKíFé €
 C ï0ë é^íïÈø^ùú 
åóÀé F  ï,ë æ¶éðø À' éðý } ùú þ 
 û Ë
åóÀé þ Fï,ë æ¶éðø 'XíKè } é0ë é í} í å®÷Nåï  [éÈë é í} J'Aí è } ùú
  û ûû û  û  Ë
åóÀé þ F  ï,ë æ¶éðøHÊ A= å X ü } ùú 
 Ë
  õÀí3þ æ®  éTA' í X ü æAèý¸ë ç1  èXépè*X' íï^í


211
Source: Ravi Kalidindi and Rohini, http://www.precisejava.com/javaperf/j2ee/Servlets.htm#Servlets102 , Best Practices
to improve performance in Servlets

©Kamal AOUDA 2005 www.kamalaouda.com Page 127 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

 ï,ë æ¶éðøHÊ
åóÀé F T=Aå Xü } ùú
 Ë
åóÀé þ Fï,ë æ¶éðø T¶' éðý } ùú 
 û Ë 
þ 

Ì?ÍdÎ%Ï6ÐÑ Î6ÒÓ
Fó = ë çžç èKõÀõžõÀíï[ì íXé3í%>Àépí3æ%Kõé éJFîíï[ì íXé
û û û û
= üÀépíA BX' íKè  íï,ú?=¶üÀépíA B#æAèXì =Aèï,ú =¶üÀépíA BKô^åKåXé^íï,ú?=¶üÀépíA B3åXéJ'AíïÈî#épèXé0ë ç (èXé^èjú

Fó = ë çìXå3ë k  ë æKë éðøÈîíï[ì íFé^äå3æÀôÈë ñÌçÀå3æ¶ô0ë ñKù3éJ'Fï^åF÷Nõîíï[ì íXéTt>XçAí¶éÈë å3æ


û û û
 p çXï^íKèXépíÌè éJA' í}õépèXéÈë çK èXé^è(X' íï^í
ûû
 ^ î#éðï0ë æAñjòóÀô ô^íï3õ?Ñ = öyæAíX÷Õî#éðï,ë æAñ3òDóÀô ôpíïÈø^ùúd 0A= íXé é^íï épåyë æ ë éÈë è ë Ao í®éJX' í}î#éðï,ë æAñjòóÀô[ôpíï ÷ë éJ'õÀå3ý®íÌõFë oAí®é^å
û
 È ë ýF ï^åXìXí(X íï[ôpåïÈý®èjæAçÀí
õ?= è X  í3æ øH ¶' éðý } ùú
 û Ë
õ?= þ è X  í3æ øH A' íKè } é0ë é í}  í å®÷Nåï   é0ë é í} JX' íKè } ùú
  û ûû û  û  Ë
õ?= è X þ  í3æ øHÊ A= å X ü } ùú?A' í è  íïSöÌõ?= é^å îléðï0ë æAñø^ù ñ íXé0òjüÀépíKõXø^ùú
 Ë
 K þ åÌõÀè3ý®í®ô^åï#æAèXì X= èï#ë ô#ë épõK èXépèyë õžõþ épèXé0ë ç þ

 K åÌõÀè3ý®í®ô^åï ôpå åXépíï#ë ôSë épõ èXépèyë õžõépèXéÈë ç



 ó = ë çìXå3ë Ì
F  õÀíï[ì ë çÀíøs  é éTX îíïpì íXé í óXíKõéjï^í   é[éJX îDíï[ì íFé íKõ?A å3æAõÀíkï^íKõÀù3éJF' ï^åX÷Nõ
û û . û .
îíï[ì íXéstX > çÀí¶ é0ë å3æ ‰ +tX> çÀí¶ é0ë å3æ1  ï^íKõ õÀíXéðäå3æ¶p é^í3æ¶é[ÿjü X íøð é^í%À> é J¶' éðý 0 ùú
û û
îíï[ì íXé®  óÀéJF óAé^î#éðï^í p èýŒåóÀéSökï^íKõ ñKíXé  þ óÀéJK óÀéðî#éðï^íKè3ýÌø^ùú
û
åóÀé ÷:ï0ë épíøTA ' í è K íï^ùúAåóÀé ÷:ï,ë épíø,æAèXì þ A= èï^ùú
 K ÷:þ ï0ë épí X ü æAè3ý}ë ç1 èXépè*A' þ íï^í
åóÀé ÷:ï0ë épíø[ôpå åXépíï^ùú

þ

5.2.1.5 Contrôler la progression des objets HttpSession


J *1*+4 N  ]^]
+
4 5   ~.!
"H   I 0I.3I 0
ƒ ;Z ,  + -! ?  ^]
   
K
­ ­
 Ÿ# 5 @ 
… *1
 *+? .! D N  ! .>=.
"?Çò h   ?  ï =h=)#±X*+   
# ï >=.*( "? 
`
",*1.  ] *+? a?€Q 5
"$

 @   M
!
 C 
:  Q"$*1ìòðÑ ","!$ H6Ž%.6u&  
: 
`
#

")  #[N 8Ê a "H#[ 
p  /",
É?  
IgJ‡ 
!   [ 5   […"? / Ÿ# 5a N  ,

4",! #.Á
&  ; ?] ! œ# 
 #/  @ !  . *+ *( #;  
 
 /
œ N 

  ",  ;
 =>=#
"B .‡?a 
 K9q q ?!~)Ê€ *1
 … 
A …!>] 
‡N 

  ",  /õ 
$ # 
*1
#a# @ d . 4 #. 5
 q!
",F
?!/0xFh›#193,7F“›# . @  a / 5   / 
 Ÿ# 5\+! ?  1
,!+ ø49F3,÷ ø 6Ž%#E׃ŽI
­

212
Les objets HttpSession utilisent également les cookies et la réécriture d’URL mais ils offrent un meilleur niveau de
performance parce que les états (states) de la session sont stockés dans la mémoire RAM du serveur. Se rendre à la
section 4.2.1.2 pour plus de détails à ce sujet.
213
Source: Harvey W. Gunther, WebSphere Application Server Development Best Practices for Performance and
Scalability, IBM White Papers, September 7, 2000

©Kamal AOUDA 2005 www.kamalaouda.com Page 128 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
1 
" =) ",  -b!0ee[ N  =>=#4 "
1*( _ 1
= €  4 5   1 *+ *( .4"?"

 
  L Ÿ# 5Mò >   ?  ì*( Ð 
c
.
Z# ?  ì ! ad #lŸ)Z

 c Ú
  C 
.
"$

 @   \ 
 ]? . 4s
JK?=) Z
#‚ /",! .  • =.Ü, 9a  *1 .‚ F*1
#N  Ÿ# 5ò h   ?  "#
 

 N 

  ",  I

 
 #a 
#
/]
  ; Ÿ# 5/ò >   ?    =)  @  a ",! . 

  ?!a   #


[ …*+ *( .[ . @  [ F"  ! f)#d .N  ! ..
Z f ] 
"   .a~#"? h .a# "H  !=.
]
 l l*+ $
gZ )Ñ- €j "H  ] j“? .>] ~5ƒ)ƒ'I^j“f=.! ( 
*(  .
 (",*1! 5g T",

N !    ?  
i T
c 5  ) i …=."H  
 *+! ÊT N 

  ",  ~)!
i
 a
 5  \9;"?+  Ÿ# !;##49  1!
"B   I 0I.3 I 0 ƒ
­
j“?]  …  S]) 
  GÐ! ?  M… š
  Gš Ú*+ $
š ?]  
 .~5ƒ~)

€ *1
 F . @  F   .",!  ! 
/! 5 @ 

 )*+ •"  ! •! ",
 
"H .•s
! 5(( h_
 ; 
Z1? 5ƒ'I
J  ; ”& ! N 

  ",  ; N !    !
4  - Ÿ# 51ò > #  ?  ; Í=.!  !9  - ?"H  ] 
‡
a
 ]  /  b 9c N  F… a #
"H  ]  ÏmÍÎÓ
ZF! ?  1¥¦#=. !I¦'mÑ:
‡ …

v


 ! 
!   *+?   (# ??
#"? ^(!>]  ×I

5.2.1.6 Désactiver le chargement automatique des servlets/JSP


`
 +",! . 
.(?? 
 5 (N 
 4=. "H  
  . @ 
 )*+ #
"$.Z_
*1 @  *+?

  c!>]
  ›.b 9T N €

 5  [N 
…"?5 5 [  : . @  c?:?_? .:",

:"$ZIef
v

$
!MM ]  
 *+! a"?ì"$.Z*+? a ]
 .Ðì
.
Z.*4*+
aš.  *(#c 
",! . 
Ê ‚ .
 K",*1! .a "$Z*+? 5 
>] 
*( /[
$
!Fc
.
 "H  
  G >=.*( "? l?? /   !
 
I j“A=.! 
"S !9C ?"H  ] F C"$.Z*+?
! 5*(  @   +b ›#!>]
  5Ð ]! *+ > ## N 

  ",   
.
 "H  ~)œ€ *1
 
v
?(ð*(", "? !4=. 1 =h=#
"B 5! • ;] 
 Å =. !N!?€  ! +",? .!€! .",? .
  

+ (=) "$
 !>] ”I € *1 ƒŽI
§£ª1³
¨ ©Ö
ã
äåjæ¶épí%>ÀéXèXéJ'Kö Jpí%>Xèý K í õFKåKçFò#èKõÀí3ö 0í%>Xè3ý  íKõ0 í=KóFñö s 
 û û

GH95 Q 7 U 7M 5 9N OHzf75 8u9 O…Ô


^äåjæ¶épí%>ÀéJ}


©Kamal AOUDA 2005 www.kamalaouda.com Page 129 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

5.2.1.7 Compression des réponses


J *1*+ !+ N  ]-€ 
  @  4
+ 5   &   
   ("?"

 !  ^!>]
  >-   
K
­
=)  # +
; N #"$
 . "H  #/Ñ † JR 
f *+ ^Ÿ.f
.Á " 
; ",*1
# ?  1 



 
I Ì ]!   ."? 9 ;",*1
. ?  &  4!>]
   “›#1 (=)  ##4
 ] ! ? ]  ? 
 ]
 Z
 .
 

> ./ 1=.)*( ",*1
# ?  !    ! IJ‡ > ./ ?=.*(   ! d #/

 !

9ï5  :U N ! .d .V Ú @   5Ú$? > V#
Üš~5
Ú N € *1
 V 
 ]! )&a ï*+  $

"?"?! 5!Š‚j ~.ƒ] ) =) + ?  
.’! 

5 .; -=.*( 1",*1 # ?  +Š‚j ƒŽI
v v
  w%EHb?Q U 97 aa9^Ef8Õ6Ö  ª){|
Fó = ë ç+=XåKå íKèjæèKçÀçÀí¶épõ¹6×¢‰ ³øsé éJFîíï[ì íFé í 3óXíKõéjï^í óFíKõépù
û û û .
 : ¹ íXéè3æ¶ü+Hˆ çÀçÀí¶é tæAçÀå 3ë æAñ h'Aí è Kíï^õ
î#éðï0ë æXñ(X ' íKè  íï,ú W
t æFó ý®íï^èXé0ë åjæíkö¸øÈøs
  é éJF îíï[ì íXé í óFíKõépù,ï^í óXíKõépù ñ íXéT(í è Kíï^õXø
û .
H ˆ çÀçÀí¶ é  t æAçÀå j ë æXñ 0 ùú þ

÷1K
W
' ë í¸ø^í A' èKõ?åïðít íýÑí3æ¶épõXøjùÈù
û û
, î#éðï0ë æXñ(A ' þ í è K íï#ö¸øÈî#éðï0ë æXñKùÈí æXí%À> éTt íý®íjæ¶éðø3ùú
û
| ˆ æ%Ì  ç?A' íKç%Ð n éJA' èFé¹6×¢‰ ) ³ ë õžõXþ ó A åï[épí 
ë ôjøSøTA ' í è K íïFq ökæKó ù
û û ¿)¿
øTA ' íKè  íï épå¦Ä A íïðäèKõÀíø3ù ë æ í%>?N  ôðøs¹6×¢‰ ³00 ù©} ùSù
ï^íXéðóKï0æ:éðïÈþóXíSú þ W


ï^íXéðóKï0æ:ôpè õÀíjú
û 
`
 ?€
 <*+[ 5 [ H N  ?=.)*+Ê c .’! @ c :# ![?] _
[ , ",*1 #  ?!

[
~.
ì N € *1
 š 
 ]! ”& î*+ $
š! .Šj JK! .! ~5ƒr ?=.*+ô ô
.’! @  ô 
v
# !1 H ",*1 # ?!
+^=.*( Š‚j ƒ'I
v
  %w EHb?Q U 989%EÕ6Ö  ªF4ÄQKuEf9KuEH{|
Fó = ë çìXå3ë ÌõÀíXé¹6×¢‰ ³läå3æÀépí3æ¶éÈøsé éJXîDíï[ì íXé íKõ?Aå3æAõÀí¸ïðíKõ?Xå3æAõÀíKù
û û .
ï^íKõ?A  å3æAõÀí õÀíXéT
 íKè  íïÈø, äåjæ¶é^í3æ¶é Dt æAçÀå 3 ë æAñ  0ñ?Ko ë %0ùú
þ W p


fe ?=) P P)


 <#P 5 P",  , .S9G",*1
# ?! C# !S ] 
"¡
P    5 #SP  
" 
?! ["ÉB
Z1Ÿ. ]!I“!   I ö   @ 
 

> .! ‡ =.*( Š‚j ~.
F N € *1
 a 
 ]!
v
"? 1!-=.
]
   ;" 
?!4Š‚j è(! 
? .œ ## *-ƒŽI
v

©Kamal AOUDA 2005 www.kamalaouda.com Page 130 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

ë ôjø^èKçÀçÀí¶épõ¹6×¢‰ 
³ øÈï^í 3óXíKõépùÈù
#õÀíXé¹6×¢‰ ³läåjæ¶épí3æÀéðøÈï^íKõ?Aå3æAõÀí ùú
åóÀéSökæXíX÷‘¹6×¢‰ ³F®  óÀéJF óAé^î#éðï^í èýÌøÈï^íKõ?Aå3æAõÀí ñKíXé®óÀéJFóAé^î#éðïðíKèýÌø3ùÈùú

í õÀí?#
 å3óÀéSö¸ï^íKõ?A åjæAõÀí ñKíFé  óAéJF óÀéðî#éðï^íKè3ýÌø3ùþ ú
û 
þ

J  1   
.
Z.*4*+
 4
 # ",
) 9 ;",*4
# ?   @  4 ? + 5   4  # !  
‡
Ÿ),  =) Ief(=. ”& ,
 ",*1#œ 1 .*1+
",*4 !  .(+ . 5  /# !4] .
 r"  !  ] 
" q .*1c",?*4*+ g- g
.
"? ? cr",*1 # ?  ,›i

",*1
# ,  

? ]  ? 1",*1 # ,  + , 
 4? ?  \]
 
 I

5.2.1.8 Include directive vs include action


`
  #
"H  ]   " c p N "H  c  "  N  =>=#
"B .? p
[  a h=.*( "? / /b  
c
v
*+d*+;*(
 <#s
`
D #
"H  ] l  " l
."?< R9S N   "    ‹S P
ZR
??"
R9D?g > #) 
! ^=)  

 . @   b   "   ] / , •",*1
 
s ÏÍ m În  " ;=)  ^ ¥¦=)  aI“$? *1!‚I Ÿ.  ¦ÊmÍѝI
Ò( 
v
 r
ZT  " !:? Ê, 5  @  :… _
*1 @  :?c",! .
c , p",!>] :c","$ :9
 N  ?  ; ",*1
    Ij“ N  , •*1 (9^Ÿ. 
1 ;b   "   ]  @   . @   "?   ç”"
v
 , ;?]  4#
",*1
 
I
`
N "H    " /
?5 œ
.
"?<  9 N   "   1/ 
Z 
??"
 9?1 > #) 
!


Z  . @    }b   "   ] À , È€
"! 5
s ÏHŸ. s“  "  
Z
^ ¥¦=)  I Ÿ.  ¦
v
=)  1$ ¥¦ ) 1 ¦#=› ÑIJ‡ > .€ "!  /",?*1*+a
  
[*+ *( #F œ[
.
"? ,!
K."?
@   …b v   "   ] c , Ê*1 !…9Ÿ. ‡9:"$ @  F=5  @  N 
 ?]   # @  d . 
 ,
?] _
I

5.2.1.9 Minimiser la portée des Java Beans


`
N  > ) 
! •!", /a N "H  !   *+ œ/
=) 
  [5 .
/ 4b! ][O• !    ! 
œ
 1b Ik  
*4*+!  1] 

?  Z
;9"?  h ) 
? ”&
 N "?"? ?  
   . ;   
v
 ! d #;# H # ? .s
Ì  /
Z ",
.! .1
#< 1 /  Z ; ",
 ",! .! • N "H   !  ;~=ÏHŸ5 s“!O• 

  ¥¦” Ÿ#
"H )â‚*+1¦!", ^¥^¦'
ZI¦›=у'I
Ì ? €}
Z  # !=# . "?   Œ  y"H  ˜Ÿ. s =.h’.þ ڟ. s“  "  "H  

=~ ÏHŸ. s“!O• 4 ¥¦” Ÿ#
"H â‚*+I¦!", ^¥^¦'# @   H 7¦›=уŽI

©Kamal AOUDA 2005 www.kamalaouda.com Page 131 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Ì  1! ?  +",


.! .I
k‚-"?1",
+    + ,  "? 4
+
( Ÿ# 4!
?  Ij“H ,

"?"? ?  
 [9[ 5! . a  [
Z ]
   .
 ap …"  ! Ê 
! Ê …
#
[: …! ?  
=~ ÏHŸ. s“!O• 4 
 ¥¦” Ÿ#
"H â‚*+I¦!", ^¥^¦”! ?  "¦›~у'I

Ì 5 ! .     
Z
    N 

  ",   ~=ÏHŸ. s“!!O•   ¥¦) Ÿ#
"H )â‚*+I¦

!", ^¥¦”

  ",  "¦›=у'I
`
 . @  Q Ð5 .
GG  P , /  *1 .
G9Ð Ð
ZL",
.! .&4 L",! 5 
 G )

! 5*(  @  *+? ^?  >Á @  D T=."q , ^   "? T] .r
 ‹! ##D ZI -",? #
v
 . @  q T5 .
c:  … , Ê . c:
 ]  [q :! ?  [[T N 

  ",  &‚ 
",! . 
• , 
  Z  Z
.•*+ *( #ô!
 @  N  ! 
>]
 ] ?€#  #
"H  1 ?€
  "   
IFJ‡U*( ?  ÚV*+ *( #Ú Ú  Ú ! cd ##ì=. 5 T V 
 …

 N 

  ",  +",*1*+ !!+ N  ]i]
-
+ 4!
"H   I 0I.3 I 0I
­

5.2.1.10 Redirects Versus Forwards


`
 ¡#  #
"B  R=h=#
"H 
 ¡ G
  gG L*+ $
¡!  #
"H #~.ƒ G N  ! .>=.",
ò >  >]
  )  ! ?! œ
 ; ! .  @   "?   4=>=#
"B 
 ;f N "H  ÏHŸ5 s =.h’.FI>IhI Ñ
#"? @   /
.’!
 Z  #f
 ?]   /. @  d .1] .; 
Z " 
 I Ì ] 
"4 N "H  
ÏHŸ. s =.h’.LIhI>I ÑG ¡",! 5 
-=. 1
g  *1
 D
 p ! .) g] .R P
Z¡" 
 IiJ‡ > .
?€
 <*+; .)  ]   , )&?*4*+4 5! .&
*( 1   ?! .
œ  4 h=.*( "?  @   

#*1 <#I

5.2.1.11 Précompilation des servlets/JSP


`
 ",*1
     c!>]   5B›.b  ! Z*+! .i*( *+! \  .*1!cg# ?
‹
v
 #Üg+ D #*1 ]
   .
\T  .I 
\"? h 5D. ?g œ=.! ( #
",*4
  ^ 5! . r  
v
" 
?! c N 
  ",  F ]! ‚c [ 
  _ 
F N ?]
 .
 *+! ‚c
.
 "H  [~#"? 
 ! !V=. #Y*(
   *+! c]
 ±
ô?]
 .
 *+! î ]  
 *+! r ! . Z# î
! 5*(  @  *+?  4",! . 
!h]
  “›.b + ",#; 4!>] 
N 

  ",  ƒŽI
v

5.2.1.12 Tags OSCache

J *1*+Tc N  ]]
[
c r5   & N 
?!*1
 
Z: ]
  [",*1!
  . [ , 
 
K
­
 .   #<    ?! 5a
   >=.)*( "? 1 
5 5! œ 
  ;  . ;9=.5 ./ =h=)   "?I

©Kamal AOUDA 2005 www.kamalaouda.com Page 132 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
  =)  #  @  þy ] 
# !! . y
   y!
"H   
#
"? ! . y?!
5  "
  <#*+? 

? . ô
r*+ > ##UV","!$ Y N  ! . Z.  . îN 
 Y!
ZIð? .=. 
 . @  N  N 
Z ‡q*+ > ##c…","$ q  F =h=# #? 5[
 ",F /]
  a",*1   . a"? =)  # 
 .!  
!=>=) "," 5 I
`
   
. ) :è\‚JK"$ cN è(  •_
*1
$,_n
> 5q
 c? !  [  *1
 : ‡  Z
! .c9"?
T

.
 <*+I
ef  +=.
)
 
(!*1
 
# ", Ü++ >
Z
 @ 
!   <#!   - ]  
 
.-N 
 
*(BŸ#
#5  ; \9 Â"$  1 
 (9/ N !    ?  4 \=  # 
I
J‡ > .  
. )  è( 1f
#"? ,
d #;!    !
 
","$ ? ?
 ( =).
Z*+? 5^+b @  4 ib ? # <# 
I
v v
`
 "ÉB
Zïè\‚JK"$ U , q  
 
 UZ. 
 5*+!   g U  .UN è(  •_
*1
$,_
±
~ ’Ê’Ê’(I  H_
*1
$,_I 5Z ƒŽI 
c N  , 5  a?Gð*+", )& ( ?=>=) Fì",
 c ! #"$
 ] 
v

!","$ I Ÿ.;
!l L# 5 5 #DõreOç'jhâÊ{ ›”  ¡L N 

  ",  l 1L
 "?  ‹=) "$
 .

!","$ I  l (
!","$ I 
. >   r
R S#  5 5 #gõreOç'jhâÊ{ ›" 
?! 
I^8‡ g=. ‹"? 
=) "$
 .C",
 Ð \=.? [*(
 =) c M
  _ *+? F !"!) ! 5…~h’iI € *1 ƒ…Ú V*(
 <#
 
 ]! .s

Ï
5
Z  1Ñ
Ï 5
Z  çñ
) Ñ
!","$^Ï ›5 >
Z  çñ
) Ñ
Ï 5
Z  çñ ",  1
 Ñ" 
?! B›#
!","$ I  Ï›. 5 Z  çñ ",  1Ñ
Ï ›5 5
Z  1
 Ñ


a","$ …
P=).
Z*+! [>  "
  F
Q
 ì
Z& ^=.? [ ! ? 5
#F ] 
"C C 5
Z
v
Ï","$ s ","$ Ý Ñ ",*4*+  ;*(? #; N € *1
 4
 ]! •s

ϝmÍÎÈ
Z; *15 7¥¦“Ÿ. ]I !   I *n¦mÑ
ϝmÍÎï 5
Z  1
) ¥^¦”
!","$I¦
.=) €1¥^¦×","$ 1¦mÍÑ
Ï$! #*1 Ñ
Ï$  
ÑEÏ   ^Ñè^JK"$ +
*(, #.  "Ï ›5   ^ÑEÏ›”$  
Ñ
Ï
 1 _ Ñ
â‚+","$  5  ;sÏm¥ !’lk‚ .~5ƒfmÍÑÏ1Ñ
Ï","$ s ","$ (  *+I  ¥¦u3,I2 ¦ºÑ
JK"$  >  s ϝ m ¥ ?’lk‚ .~5ƒfÍ m ÑÏ)Ø ~”=)#  $ ;] >_3,2+!
",
,ƒºÑ
Ï ›","$ s ","$ I  ÑÏ ›”
 "_ ÑÏ›”$! #*1 Ñ

©Kamal AOUDA 2005 www.kamalaouda.com Page 133 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL


 . H .• 4=. "B  
 *+! + 5
Zš B=.? "$.Z
œ /
Z;9
   
.1#
) ! 1~)? 5
v `
# =).  $1 ]
 Z
 .
5ƒŽI 
 ./;","$
 N   "# *+! .  . @  / 
 5","$
/# , .
=) € IgJ‡ 
! lN  :N
",
 —
È  :— W™3,2Œ!
", È! #Ô"$ @  
. =)5,×"$
 ?!*+!  1
 .4","$
1 H ? 5*(  @  *+! *1 !+9Ÿ.
”I
j“H ,  Z
 *+?  ?  
 41","$  4",! .
-
+ 1",
#4N 
 4? ?  1!    ? .
”s
Ï","$ s ","$ (  *+I¥¦u3,2I¦!", ^¥¦”! ?  "¦Ñ
>I IhI
Ï ›","$ s ","$ IÑ

è\‚JK"$ g , ^!? ‚",!


 ‹N 
??" \ r !  =) ! 5r

 @   ?€ 5 Z
T=.Ü,T9
?]   (# =# # "?
\N ! # ^b ~>] € *1
  ƒŽI
v
§ £ª1³
¨ ©h ¼ .² ³
ã
ϝmÍÎÈ
Z; *15 7¥¦“Ÿ. ]I !   I *n¦mÑ
ϝmÍÎï 5
Z  1
) ¥^¦”
!","$I¦
.=) €1¥^¦×","$ 1¦mÍÑ
Ï$! #*1 Ñ
Ï$ 
 ÑEÏ   ^ѝe€*1
 3%Ï ›5   ^ÑEÏ›”$  
Ñ
Ï
 _1Ñ
â‚+","$  5  s"Ïm¥ !’lk‚ .~5ƒfmÍÑÏ1Ñ
Ï","$ s ","$  ÉH!1 _ ¥^¦×£
²?²?¦·¸ £ ¬.© ¥ .H©"Å ¦Ñ
JK"$  >  s ϝ m ¥ ?’lk‚ .~5ƒfÍ m ÑÏ" Ñ
Ï ›","$ s ","$ I  Ñ

Ï$
.=D¥¦Že€*1
  0I Ÿ. "¦ºÑ‚ =).,”"$
 =Ï›#Ñ
Ï ›”
 _"Ñ
Ï ›”$? *1 Ñ

§ £ª1³
¨ ©1i¼ .² ³
ã
ϝmÍÎï 5
Z  1
) ¥^¦”
!","$I¦
.=) €1¥^¦×","$ 1¦mÍÑ
Ï$! #*1 Ñ
Ï$ 
 ÑEÏ   ^ѝe€*1
  0I Ÿ5 1Ï ›5   ^ÑEÏ›”$  
Ñ
Ï
 _1Ñ

©Kamal AOUDA 2005 www.kamalaouda.com Page 134 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

{   $
 Z4 $ 1","$ IhI>I Ï1Ñ
Ï","$ s =)  $1ÉH!_1¥^¦ñ£
²?²?¦·!¸ £ ¬.© ¥.H©Å"¦•?", ^¥¦”

  ",  "¦#›=Ñ
Ï$
.D= ¥¦Že€*1
 3 I Ÿ. "  ¦ºÑ 5
=Ï›#Ñ
Ï ›”
 " _ Ñ
Ï ›”$? *1 Ñ

`
4b e€*1
 3 I Ÿ. (",
"$  
  >  (+",
+1 
B
??" !  ;" v¦œ£
²?²?¦·¸ £ ¬.© ¥.H©Å"¦ŽI
` v
b e€*1
  0I Ÿ. q!    !q"? > .q" =^
Ê]
 ^ q","$ I‚
^
c  .q",*1*+#",
v
 
"H .
 @  & :"  ! ‡d #c", "

… _
*1 @  *+! p
Ê","!$ A  [ ?=.*(  F
  + *(
Z \ + .

 5
I

è ",$ S *+ + Z


 *(! (S  *1 .; S*1
.DN  Ÿ# 5R
 "? r
g ¡","$ I 
\
v
 =.! )&"?c*1
#a , ‚
T3,2
2
2a
F F] .  :3 I ‘I 7…*( F
 /=.  h . ! ”&œ c*+ *( .
` `
 , z# !    !
P! G N  Z
) $
*+ Ê8Y~  
, 
"?!  _L8‚! 
ƒ @  CD ]D ͟.9

# !! . [
a …!
"H   I 0I 0I 0I 
KZ*+! 5p [ 5   [a","$ &f  ?=>=) N  .p 
­ v
=) "$
 
!","$ I“
. 5   l N BŸ), . P]  L.*+< #G","$ I "H" h_I1j“i ,
 ! ! ##g> \
?  
 Tr",?=) Z
#iè\‚JK"$ g!
^","$ -  [=.
Z*+! >cg
ZT 

^
  @  I 
Ê"? q  ?=>=) K*(
 =) A .*+< ##—","$ I“ $[c 


! ‡",*4*+
v
] 
 1"$ *1 (P# 5 5 #+  @  4Ë-(? $ .1",!>]   \


 
I

J‡  ”& F  


. ) è\‚JK"$  
?!  , 5
 N €
 ) *+! 5  I Ì  Ÿ.
.N $

   ,
!    !
rA a  . [!? f
# H  Z ?€ @  : $  ?>] .  I ",*U   =) " c 

>
N 
 1",*4*1
! . +  5
Z.*4*+
.^;
 -4
 \Z. ??! .I

5.2.2 Optimisation des Enterprise Java Beans

5.2.2.1 Appels distants, EJB 1.1 vs EJB2.0

Ì  1 =>=# #"?4 4eb


O0I 2&   +eb
O[ *1
 *+? . ^! 1 1 
" =) ",  3I.3\ 4 

> .!
@  c  
   , 5? 5
I•efN ! #  .*+  &œ  F N ! ‡
…*+  $
 F 
",  /",*4*+
"!N  ,  F",
  eb
O0I 2I•â‚  ]1]

/ [5   @  [  / ?]", #   , 5! . 
­
]
 [ a
. 5", [ÊÑ;j ç'j>j è    !! œ? 
 F / 
 @  a  .*1;a# !I 

v v
"? > .. ?  B=.! •?    !•   
" =) ",  40I 2;   4   
" =) ",  3 I.3( . @  N 4/ 
"$ €I

©Kamal AOUDA 2005 www.kamalaouda.com Page 135 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Ì   . 5! .!=.  @  r"?5 5 :",! .  .cN eb
OS",*1*+qb
O•è\GgjhOfÑîõ 
$ #
 )*+ > .? ʍ",?] 5    c ?]",  a , 5! . a…
  c ",?€ . @  T "  ! p
 N eb
Ol!q .?] ? ?q R*+d*+qb † Ñ1I‡J‡ > .T?  q , N $
 q"H  ]!
 T
q  
=) "$
 .lG 
  *+! /~) A=.? ",
 . C "
*+! 5  PP",! . 
F

 
N  ?=.)*(  ^91"?4  Ÿ# >ƒ'I

5.2.2.2 Mettre en cache les objets retournés par les lookup JNDI

Ì " $ @  4=.  @  N 


1"  ! • ?] @  
eb
O‚&
  ",! . 
€ "! .
 # @  d .1b
âÊkpj 
   ",  !  
B =h=#
"H .+ 
 . 
1 ! .  Z #?+"B_ " 4-]
 (]
   +*+  $
 
  N  ! .>=."?eb
Oò‚*+IJ‡ \ .  \?! #  
! . 
& 

 ?! 5 +
 1",! .  
 \   ?! . q
- q .*1cg# !Ipj“f , \
?  
 Tg  : ]
 .i œr*+ i
","$ G  g Ÿ# 5leb
Oò*+G# 5
) g
#< ¡ G
#*1 <#P ?]",  ¡=h=.
"H 
G 
`
"  ! ”I N € *1
 4 
 ]? *(! ##1",*4*+! *+ > ##4+","$    \ Ÿ# 54eb
Ofò‚*+4
+

ò‚
 $
*(I

214
import javax.ejb.* ;
import javax.rmi.*;
import java.util.*;
import javax.naming.*;
public class EJBHomeCache {
// cache home references in Hashtable
private static Hashtable homes = new Hashtable();
Context ctx;
public EJBHomeCache() throws NamingExeption { }
public static synchronized EJBHome getHome(Class homeClass) throws NamingExeption {
EJBHome home = (EJBHome) this.homes.get(homeClass);
if(home == null) {
ctx = getInitialContext();
home = (EJBHome)
PortableRemoteObject.narrow(ctx.lookup(homeClass.getName()),homeClass);
this.homes.put(homeClass,home); }
return home;}
private Context getInitialContext() throws NamingException {

214
Source: Ravi Kalidindi and Rohini Datla, Best practices to improve performance using Patterns in J2EE,

©Kamal AOUDA 2005 www.kamalaouda.com Page 136 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Properties props= new Properties();


props.put (Context.PROVIDER_URL,"urlname");
props.put(Context.INITIAL_CONTEXT_FACTORY,"nameservice");
return new InitialContext(props);}
} //end class


+
"  "$ 1 S*1 !¡R","$ R
#< g P .*1 <#S ?]",  &^ D"  ! 1 N  @  N 9
v
 
  K [  /F#  
"H 5!  FH_
? 5 €  
 ]? .s•â‚*(O• F$ !] .     ¥
~”â‚*(O• ƒ'eb
Oò‚*+
JK"$ I Z )ò‚*+~”â‚*(
O• I Jp 
??ƒ¨§
`
/=) Z
# x[*(! ##[   Z
 F >=.*( "? @  F"? > ./ . "$

 @  [ )*( f[#   !
­
 
 +!>]  •jhOÑRõ
$ #I

Figure 48: Comparatif des performances, caching des objets EJBHome vs génération d’une requête
JNDI pour chaque invocation

5.2.2.3 Impact du niveau d’isolation des transactions sur les performances


`
 [
 #.?"B  …?? A,?] ! A9‹ N ) Z  qN   " ! 5 @ 
•",*1 .*+ > .? ^   .
) . 
Ì Jjhkf6Ž%.ofN 
  
!4
4
 
 
I )*1B"? +  " ! >+\" 54s
v

215
atomicity, consistency, isolation, and durability

©Kamal AOUDA 2005 www.kamalaouda.com Page 137 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

¸ ¤5¬hÅS¤#© £
¥FÖ^!L
5

  . @  N 
 l .?"B  DðK3D*(
 =) L P",! .
¡N 
 L
!S
ú



 q @  N 
 r .?"H  qð0¡  \"?g",! .T ]! @  rðK3q N =>=#
"H  D g",*1*1 )I
Ì 
#<   F 
"H 
# ",! 5
ð0& ðK3+=h=#
"B  /
.  "É( f "  ! !>]
  
   *+!
ð01! # .?] 4] 
"i + ?=.*(   @ 
?  .=) < .!  i=) < *+?  1",! .
(  
`

!FF


 /~#"B=”I=) Z
# ù ƒ'I N € *4
 F 
 ]! K *+ f[*1 ?€",*1
##a"? > .
­
 _
*1 @  I

3 I ‡ 8 D"  ! Ì @ 
‡G
 ¡! 5) ?  R ҕ3,2
2
2D
4?S",5 .¡l"!#  4!=>=#
"B  P

]
 #*+! úÒF3,2
2-] 5+ 1",*1? .4N 
("  ! O @ 
B
(? +vÒ17
2
2I
`
0I ; .!?"H  +ðK3^ 
 .   ",*1! .11"  ! Ì éҕ3,2
2  "#  .;"? 
,4"  ! œOa
*+d*+F*(! 5? œ? =>=.
"H  
",*4*1 ‚~) /? /"  ! Ì ]
 ! Òù
2
2 f"? 

O]
 !^ Ò÷
2
2 ƒ'I
ÎI Ò(  @   *1    !
", ;
#< 
& / #.?"B   ð0 6Ž%.tp , œ
"  "$
a
", "
   
 ! . #d 5^    Z
 ҕ3,2
2; ) + 1"  ! Ì I
I ef. ?N 
 .
 <*+ .
"$

 @  ðK34=h=#
"B  a .  "É; f


 ‚ N  .  I
­
Ì  ; 
 .1;.  "É-  (?  - -?€4"  ! 5(]
 
 ! ",*4*+  ( 5 !  ]!
  
!  + .?"B   *(   "  ! Ì  ,  5 Ÿ.
. # ]
    ! . .d 54 
  
ҕ3,2
2I

«
¤#©³ © £ ¬5£´
¨ ©¤#© £
¥s•!
.

 p . @  [ðK3F  p
[",! .
 @  [ð0q*(
 =) [ ]! @  [ðK3
Ù
 N =>=#
"H  ; 1",*4*1 ~#"B=”IH= Z
#17
2 ƒ'I
f¢ Ä£«!¬5¦ªW¤#© £
¥Ö‚!‹
.

 ^ . @  N 
  .?"H  T#
Ü, ^ 
! A?"B_" q:]
 q 
# ! \ =>=# #! . ^9   *+d*+;# @  d .I !€ *1
 4
( +=) Z #173(s
v
3 I è+kÊ8KJ ð ¥ Ì 2
23i JKè+Ñ Ì âœÞ kjhk ¥F3,2&? ]?  4 
!  i #.?"H  !
I
v `v
0I ðK3^€
"! .;  # @  d .s?Ke eœJð è+kÊ8KJðõròÊeÊeaJ‡è+Ñ Ì âœÞ kjhk ¥F3,2I
v v
ÎI ð0  !<# 
|?] C
# Z , ##*+? ±

  =>=#
"B    |",*4*1 ”sôjhâKeð
è+kÊ8KJð ¥ Ì 2
2 0SõròÊeÊeaJ‡è+Ñ Ì âœÞ kjh+ k ¥a3,2I
v v
I ðK3€
"! .R ",#¡
 T=. ‹ l# @  d .g¡ N 5 g0Iief  g!  ! \ ‹#  
 5 5
­
 =>=# #? 5\ . @  ;  # @  d .  N  -"$Z I

;
# ] 
 +"? R
   " ! 5r¡  R  ?!+!¡
.

 #&^ DZ H  
 .DS
! r
v

 

 q*+ i ©?]
#q q*+
",
  *+ c]).
   
ZT
  q
 ]  ?€N  ?   I

216
Cet exemple est hypothétique. D’habitude les chaînes d’intérêts sont déclenchées à la fin du mois et le client bénéficie
d’une période de grâce qui peut dépasser les 25 jours.

©Kamal AOUDA 2005 www.kamalaouda.com Page 138 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

J  ¡*+
",
  *+ ¡# Z ??! 4? 
 S  g #  gG 
"H 
# @  G  g .  
‡
N
") 
#IAk  
*1*+! iR ‹Z.

 ) . ‹"$   ‹ iT‚Š(OkÊì!     &p  T ?] !
N 

  @  œs
Ì 
 44
   
.+  Z  +~# # Z , .*+? 5?ƒ'I
Ì 
 44
   
.-",    +~#"$*1^( > #) 
! 5,ƒŽI
Ì ?€- 5
  
I
Ì 5! .; 
!++

  
I

¨ Å-£¨ ¸ ©¹(¥©;«¦ ¬.©¤æ¹ © ¨ ©(¬.©ª1³²^¥© ¤#³¦«²!©4© ²,¬¥Ã £¹!¬5£«!¬³


¨ ¹²\»¤.£«¥4æ¹ © ¨ £4»¤.£«
¹
¨ £¤)¸ ¬.Â4© ²,¬
ë
¨ ©Æ Â
©¼

217
Figure 49: Dirty Read

k‚1
 ;

  ",   @ 
 !    !  +!  h_   1
œ ! ..
Z  ] 
"4 /
?;;


 
&
  ; .?
"H  ;?! • #. .
  ! F a*(
/
" .  =”IcJ‡ F  Z
 =)  @  a FZ ,   
.?"B  + H ",,=)
11",! .  N eb
O6Ž%.„ @    1
 ]  ?€4N  ?   4?!  !=) 
 
1
 ]  ( =) "$
 .^+ 
  *+!  1 N  ! .)*+   #4; N Ì j?b?ð Ì 6Ž%.ˆ‡I
v
`
+ 5
  (0Î+ =) 
   (
 ]  ?€(N  ?   (

  ",
  \?€\ .?"B  4eb
O‚I

217
Source: Ravi Kalidindi and Rohini Datla, Best Practices to improve performance in EJB,
http://www.precisejava.com/javaperf/j2ee/EJB.htm
218
Se rendre à la section 4.2.3.5 pour un comparatif des performances de la persistance gérée au niveau du bean (BMP)
avec celles de la persistance gérée au niveau du conteneur.
219
Les sessions beans supportent aussi bien le mode déclaratif que l’API JTA (Java Transactions).

©Kamal AOUDA 2005 www.kamalaouda.com Page 139 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Figure 50: Unrepeatable read

Figure 51: Phamtom reads

Tableau 23: Niveaux d’isolation des transactions EJB

Incidents
Niveau d’isolation Non Repeatable
Dirty reads Phantom reads
reads
TRANSACTION_READ_UNCOMMITED Permis Permis Permis
TRANSACTION_READ_COMMITED Non permis Permis Permis
TRANSACTION_REPEATABLE_READ Non permis Non permis Permis
TRANSACTION_SERIALIZABLE Non permis Non permis Non permis

©Kamal AOUDA 2005 www.kamalaouda.com Page 140 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

“j H ,  *15 5? ; .  @  1"?4??   +


 ]  ?€-N  ?   1  +
 + *1 ?  =. @ 
B?  
*( \N  *1"B     (  >=.)*( "? (~#"B=”I, 5
  -0 ƒŽI
­
Tableau 24: Impact des niveaux d’isolation sur les performances

Niveau d’isolation Performance


TRANSACTION_READ_UNCOMMITED Très rapide
TRANSACTION_READ_COMMITED Rapide
TRANSACTION_REPEATABLE_READ Moyen
TRANSACTION_SERIALIZABLE Lent

5.2.2.4 Accéder aux entity beans par l’entremise d’un session bean
JK*1*+gq N  ][]

q R5     !  h_r  c?!  :"H*1
?! >… #< 
­
   ?! 5
   >=5)*( "? 1N 
 a> ‚."? @  N   ;?! ‚ ?]",
  +]
 …ÊÑ;j çŽjhj è
v
 N ! #…5 K#"? @  N   H_
 "$
.
 !! K 
.  > 5 ] 
""? 

… c
!FF


 
??ç Ÿ."?! .I
â‚ 5!+   
. @    . @     \!  h_1  ^?!  ?] @  \ #
"H .*+?
"$"
 4   .(*+  $  - ,
#. .
4",*1*+;  + #.?"H  I
`
 =. +=.#"?•  4# @ d . -91 .  .••
+! ?  ;  + ]! N d #1  Z
 4~>]
 
+

D
  ", ƒ9C N !  >_S  S )*+ 4N *+   #  ¡ >=.)*( "? gG N 

  ",  
",*1*+; ;*(! ##  (=) Z
.L7 0I

Figure 52: Comparatif des performances, accès direct à un entity bean vs accès via un session bean

©Kamal AOUDA 2005 www.kamalaouda.com Page 141 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

5.2.3 Optimisation de JDBC

5.2.3.1 Choix du driver


`
 ;) ] 5 @ 
 )*+ > .! œ9[ N Ì j
b
kÊOœJRN  ! .. Z f ] 
"
 F
!/


 # <] ?
v
  N 
 4  @  #4", . Z
)  \ 
 ]! . 
s
b
kÊOœJKç”è+kÊOœJ‹Of) 
Z

â‚  ]  ç Ì j ›”5  _\b! ]4 ] 
• v
â 5çñ
. 5", ›#  çb! ]4) ]

â‚  ]  çñ
. 5", ›#  çb! ]+) ] 

`
 1) ] . # ]? •F …³
¤#©ª1¸ µ¤#©·,£ ¬. »
¦¤)¸ © .  .! ‚
 F
,!#  /è+kÊOœJg ]!
 N "$ *1    ;
   a N Ì jb
kÊOfJ‹] . /Z ,  
 #/a
!/


 
I #"?
v v
@  N è+kÊOœJG , ‡
") ‡…JA&  
 ] ! ‡=>=#
"B  ‡ F",?] .   @ 
?! ‚ ##< F",Ï! .!! 

    h=.*( "?  Iâ‚ 5 •   
. @  "? 4) ] .4  ] ! f
"? ?? #*+? •d ##
 , 5  - 
• 
, .1+"  ! 
 @  N  !

 ?!  ..
Z  ]  "+ 
!11 

 4~. 

 :# ! :j“! .) Ê  / ]  
 
.a N !  "
F",! .Á [ 
L  /) ] 5 Ê  a
 Z
çñ 
 , 5  \ 
  +
H . \
 -"  ! 5?ƒ'I

220
Figure 53: JDBC-ODBC bridge

`
 a) ] 5aT ¥©¹?§
¸ µª+©:·,£ ¬. »
¦¤)¸ ©",?] 5  ??!   a
  FT N Ì j•b
kÊOœJP]
 r
 
v
 ! .>=."?/  ] /~>b
âpj ƒ @ 
? ,  

5 .
/f  Z ,  
 # /
!  


 
Ij“ +??

 ; >=.*(? 54",*15  ] *+? ?€1) ] .+ 
#*1 <#", . Z
) /*- ;
 @  N   
=. "H  
 ! ",#
"H 5*+! •
 >  ; 
œ?_? 5 ",
;
 d ## , 5 
1 
œ 
H .;
"  ! ~.N ËG  *L5  _\b! ]1) ] 5ƒŽI

220
Source: Nitin Nanda, Learn how to deploy, use, and benchmark JDBC driver types 1, 2, 3, and 4,
http://www.javaworld.com/javaworld/jw-07-2000/jw-0707-jdbc.html

©Kamal AOUDA 2005 www.kamalaouda.com Page 142 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Figure 54: Native-API/ partly Java driver

`
 4) ] 54/ ¬¤.¦¸ ² ¸ µª+©·,£ ¬. »
¦¤)¸ ©?? •?  <.*+! 
") >14b! ]/ N  ! .< Z#! 


  #"$
 .
"B 
#9 #. +  .
Ij“ 1?] ! f  4
  4 N Ì j b
kÊOœJ‹9F
/*1 
 !’#;]
 
v

D
. 5", l   
! -‹Z ,  
 #Rl!
!RR


 
I Ì #
",!  ‹D"? 

  1 *1 
 !’#  +",?] >  
1
;
. 5"H ; 
" =) @  ;4Z ,    #;
!
`
1


 
I  -) ] .\  ", . Z
) ;Î4 =h=)#? 
;*+   
•
 ]  + >=.*( "? @  
  l) ] .lÐ Q", . Z ) L0M#"? @  N   l 

5 .?  ¡ .
"$

 @   ¡N !  *1 ?  
",*1*+c [Z H  F","$ [ ‡ c 

:  " Z 6”6Ž%'I Ì  . @  N  ] 
""? > .a", . Z
) &œ 
"  !  N 
+  ? (N  , 5   4) ] !
,]  ! .. Z  ]  "( 
?44


  I

Figure 55: Net-protocol/all-Java driver

Ì  N  , 5Ê F) ] .Fq ", . Z


) :Î&‚  [¥¤)¸ Æ ©¤.²F¥©q¨ £T·,£ ¬. »
¦¤)¸ ©c®T?! Ê!  <#*+!
`

") 5[[b!]I  i>  "
 ) . "!N  , @  N   c#
"H?] 5  ?!?   a
  FT N Ì jœb
kÊOœJ
v
 #
"H .*+! A
 ‹ . 5", q 
" =) @  q‹ ‹
!qq


 
Ip¢¦¹
¤^¸ «!¬.©¤.£
»¸ ¤A£ Æ ©
·
Å Æ
¸ £Cá Ä ä+·à © ²,¬·?© ¬>¬.©C·,£ ¬. »
¦¤)¸ ©L¥©C¥¤)¸ Æ ©¤²P湸i¦ ¶>¶)¤#©Ð¨ ©Mª+©¸ ¨ ¨ ©¹
¤F«¸ Æ © £¹P¥©
ê — Õ Ù+ß ú é
³ ©¤>¶.¦¤ª(£« ·?©¼

221
Technique consistant à partager et équilibrer une charge sur plusieurs serveurs.

©Kamal AOUDA 2005 www.kamalaouda.com Page 143 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Figure 56: Native-protocol/all-Java driver

J   ”&



   + . , 54
 >=.*( "?!=>=#
"B  ;f =>=‚k‚ ]
 Ñ(  [j“" &"!N  ,  ] 
"; 
‡
) ] JK
 
"H 5ÊbH6”6”6 @  ‹Ñ^_ @ N  , @   =) :T
#*1 i.Zqc"? @ 
•", "?) T 
 
  / P .*1¡Q. !Q~#"B=”I^=) Z
#L7
‘ ƒ'I4â‚ 5P   
. @  Q  R] .  
#
"?! . 1/"?) ] œ?! œ7
29:3,2
2 =. 
 .   @  F  +] .   
    
IkF
 
   \ 

5 .!   *(
+, # *1 Z @ 
? )*+ ,€1# @  d . \;#?] _  1*1
#( #< 
 *15 5? gN 
# Z , ##*(! 5U?ï",?*1*+R€ "? ?  ] *+? ¡ Œ*+ *( #± 5*1
~.N 
#< ‹ g  5 ’Ê’Ê’(I“*^_ @  I ",*  g) ] - H -"H
 g¡#?] _ ‡Ÿ) @ " ! 9R0RZ Z

 5
N 
# Z , #*+! 5,ƒŽI

223
Figure 57: Database benchmark/ Ziff Davis Media Inc

222
Nous rappelons que Connector J fait partie des drivers de la catégorie 4.
223
Source: Eweek, Database benchmarking, http://www.eweek.com

©Kamal AOUDA 2005 www.kamalaouda.com Page 144 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

5.2.3.2 Connection pooling


J *1*+[/ N  ]1]

/ …5   &
 ]  
 
K [ ! 
 ?[ )*+ > ##
K
­
"#
! 5? fF",
 €
  @  N   _a[# @  d . ! .! .  I•k[ …*+d*+[*(
 <#&  
 ! r
ô> 5
Z‹
 ô!
 U",
 €
 ô! .ô 5! . ô  ô. @  d . ìU)  @  î
",
*1   i . .*+? 5+.  <  -   ^"?"?< \", "
#!   \9  
!(4


 
I
8 C",
 
"H  Ð
-",! ) 
 Q9š N *+   .  G C h=.*( "? GQ5 5
Z ? a

‡
*1
#q# H # ! ‡",  €
 a ͟.9q"#

 a! ##T  a =h=# #? . …# @  d 5 c#
Ü  …
 N 

  ",  I

k‚C Ð 
 .QM"? > .C!
"H  ÐP

 .C
C€ *1
  @ 
+*(! #Ð",*4*+?
 *1
 *+! .…  L",
 
"H  M
 G
Q
 M

  ",   @ 
4!    !Qð•*+", F",*1*(
",! . 
”&-Ñi_ @ Ê",*4*(¡Z ,  
 #¡P
!D¡


 g 1JK
  "H 5+bg",*4*+
) ] ×I

k‚ ð*+", K  ",


 
"H  a
 ?! f .
      *+! K *1
 *+! . 1]
 c  " 
?! 
kÊOœJ /b!ÉB5 5aJK*4*(B6”6)ž IJ‡ 
!  
 H œ? 
?  
 ^! !    !"!  *1> . @  
v `
! #;
 @ 
? *1
 *+? 5  !  ! .h=."?AŸ. ] €I  @  Ihk‚ >f
#"?I  -  5  +  *1
 *+! .
  -",
 
"H  1
 ^
!^ð*(", ?! 
"!) . \" ç)
#< B6”6”o‡s

224
Site du projet: http://jakarta.apache.org/commons/
225
Le code source pour tester cet exemple est disponible à l’adresse suivante :
http://christophej.developpez.com/fichiers/pooltomcat/TutoPool.zip

©Kamal AOUDA 2005 www.kamalaouda.com Page 145 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 ) ] pJK
 
"B 5KbF p  =) "$
 .b Ì l [!"ÉB
Z /b!ÉB5 5 ç×JK*4*-…kÊOœJ
…
• v
3 I 2&•b!ÉB> 5
ç×JK*1*(aJK  
"H  F0I 2: Kb!ÉB> >
ç×JK*4*( 
‚3 I 2c  ] ! Êd ##
` v
 , 5  \
+ ;#  > 5 . ÒJ Ì ð Ì jhâ Ì kòè(Ñ1e›#"H*1*(H›”  I
JK?=) Z
.  rq=) "$
 \g 
  *+! ’iI € *1‡
- 
" =) 4 ¡*Wb
âÊkpjÊ

k‚ 5f
#"?~.
  ##€ *1
 & !>]
  N 
    Å ðf! 5 
 N   ;=. 5  N 

v
"ÉB
Z *1*+ Å ! >)  N,  
!+4


 ^,?ç Ÿ."?! . ^N 
   Å 
!N ƒŽI

ºI a%b I 9GU 9 U w^?5 QI 9v9KuE Ú9Mƒ x v 5 Û\Û\Ü

´>Ký ìXíï^õFë å3æKö  ?lí3æAçÀå jë æAñö $¦Dÿ)° s´} ÝsÝ\Þ


 û
®
q žäIÿ߂³tk÷Ní= þ è ³)¦|ò)£‰ ä¸  ðî(óW æ}ë çXï^åKõüXõépíý®õ ‰ æAç  TDÿ)ŸCí=1ˆ‚  ë çÀèXéÈë å3æ" # sthr
 û
…'¶é éT /   [l èXìXè õXó æ çÀåW ý1Xéf% ÷í= è  W " # Xéf \} p þ þ

÷Ní= è  } þ þ W   þ
 W j ë õ? èXü æXèý®íF} ÿóÀé^ål ³ åKå 3 ë õ? èXü æAèýÑí}
 û W û û W
õÀíï[ì íXéJ}
 û

Å89Gmg 5 9%EHÃ&K7v+9Ô?i©`EQªFQ Q5 Å%ÆH89Gmg 5 9%EHÃ$K7v9Ô


Å89Gmg 5 9%EHÃsa?5 7 88 Ô%EJ`EfQGTI 75 ƒ i©`EQªFQ Q5 Å%ÆH89Gmg 5 9?EHÃsa%5 7 88 Ô
p õÀíï[ì íXéJ}
 û
õÀíï[ì íXé ýÑè  ë æXñ}
 û W
õÀíï[ì íXé æXèý®íF } ÿóÀé^ål³ åKå ^ õÀíï[ì íXé æAèýÑí}
 û W û û W
óKï X  èXé épíï,æ?}% ð óKï A èXé[épíï0æ }
 ûW  ûW
p õÀíï[ì íXé ýÑè K  ë æXñ}
 û W
ï^íKõÀåóKï^çÀí ï^íXôJ}
 W K íKõÀçXï0ë ¶ é0ë åjæ?}

êXôpêï^í3æAçAí è¸ï^íKõÀõÀåóKï^çÀíyò‚¸A
 å3óKï í*A å å
. ! û û û
f íKõÀçXï0ë ¶ éÈë å3æ }

ÅG9 8%ÅG9%zHÃ$K7v9ÔdfUM%adÆmi©`EfQª0Q Q5 Å%ÆTG9 8%ÅG9%zHÃ$K7v9Ô
ÅG9 8%ÃJE Œ ^9Ôdf7%g%7%xƒ 8à5 ƒ ¡)7%E7 D©Q` Ga9Å?ÆTG9 8%ÃJE Œ ^9Ô
ï^íKõ èóÀéJ' } ä|å3æ¶épèjë æXíï ð ï^íKõ èóÀéJ' }
 W  W
ð ï^íKõÀåóKï^çÀí ï^íXôJ}
 W
 ÷Ní= è ?}
 W

226
Basé sur un tutoriel de Christophe Jollivet, publié à l’adresse
http://christophej.developpez.com/tutoriel/j2ee/pooltomcat/
227
Cette section doit être placée après la section servlet-mapping.

©Kamal AOUDA 2005 www.kamalaouda.com Page 146 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

J ?=) Z
#X y=) "$
 ï!>] ”I € *1ì~.
 "? =) "$
 X!)*+  ±
?B’.
K

",)#  ? [?€Ú5*+< ## QN ! $ !  =) ",  MN 
Ú!    ? .
 @
 4î š.
N "?"? 9  
!+4 

 ?ƒŽI

š 9 8Q` Ga9 8zf7 adEQGmŒÆ89Gmg%9Gsƒ x?v 5 Û\Û\á


äåjæ¶épí%>ÀéXèXéJ'Kö J[ÿóÀépå³#å å 
 û
ï^í K å è Kè= í3ö ÈéðïÈóXí 
û û
KåKçFò#èKõÀí3ö Hâ[ÿóÀépå³#å å h}
û
íKõÀå3óKï^çÀí
 .
%K 7v+9NOmmUM%adÆmih`EfQª0Q Q5 O
7`EHb NOs4ÄQKuEf7I K%9GO
E Œ ^%9NOmm7%g%7%xƒ 8à5 ƒ ¡)7?Ef7D©Q` Ga9 OTÆJÔ

íKõÀå3óKï^çÀí³#èï^è3ý®õÑæAè3ý®í3ö mlf=Açd[ÿóÀépå³#å å \}


 . û
Aèï^è3ý®íXé^íïJ}

Å0K7v9Ô`%89GTK7v9Å%ÆsK%7v+9Ô
Å g?75 `%9Ô`%89GTÅ%Æfg%75 `%9Ô
JXèï^èý®íFépíïJ}

Aèï^è3ý®íXé^íïJ}

Å0K7v9Ô^%7 8%8dÚ6QGUÅ%ÆsK%7v+9Ô
Å g?75 `%9Ô^%7 88dÚ6QGUÅ%Æfg%75 `%9Ô
JXèï^èý®íFépíïJ}

Aèï^è3ý®íXé^íïJ}

Å0K7v9Ô UGTI g%9GH4—5 7 88?ã7v+9Å?ÆsK%7v+9Ô
Å g?75 `%9Ô QGLƒ Lu ETƒ v vƒ v1Œ%8à5 ƒ ¡¢GJI g%9GTÅ%Æfg%75 `?9Ô
JXèï^èý®íFépíïJ}

Aèï^è3ý®íXé^íïJ}

æAè3ý®í
} óKï 0 æAèýÑí}
 û
ìXè óXí}dlmA
= ç / ýžüXõ /   åKçÀè X' åKõéT/ # #  JX= èKõÀí  ìXè óFí}
 û û û û ­  û
JX èï^èý®íFépíïJ}

 íKõÀå3óKï^çÀí# ³ èïðèý®õ%}
 .
^äåjæ¶épí%>ÀéJ}


228
Cette section doit être placée avec les autres déclarations de contexte entre les balises <Host> du fichier server.xml

©Kamal AOUDA 2005 www.kamalaouda.com Page 147 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

4‚Q U 9 U 9(5 789Gmg 5 9%Ei©`EQªFQ Q5


AèKç%nèKñKí®éÈóÀépåï,ë è ú
û
ë ý X åï[épl èXìXè ë å ú

ë ý X åï[épl èXìXè þ õ þ ½ ú
û
ë ý Xåï[élpèXìXè%> þ æAè3þ ½ ý}ë æXñ ú

ë ý Xåï[élpèXìXè%> þ õÀíï[ì X í é þ ½ú
û
ë ý Xåï[élpèXìXè%> þ õÀíï[ì íXé þ ½ 'Àé éJ ú
û
ë ý Xåï[élpèXìXè%> þ  õ ú þ þ½
û
Fó = ë çžç èKõÀõ:ÿ þ óÀé^ å þ ½ ³låKå í%>Àépíjæ%Kõé éJFîíï[ì íXé
û û û û
Fï0ë ìXèXép* í  èXépèîå3óKï^çÀíKõKúd  è}õÀåóKï^çÀíKí å3æ æAêKíKõ
û
Fï^åXépíKçép í ÑìXå3ë K å ¹žíXéðø
é éJXîDíï[ì íXé í óFíKõéjï^í 3óXíKõ¶é
û .
é éJX îDíï[ì íXé íKõ?Aå3æAõÀíkï^íKõ?AåjæAp õÀíKù
û .
éJF ' ï^åX÷NõîDíï[ì íXést>XçÀí¶éÈë å3æ ‰ +t>XçÀí¶éÈë åjæ1
û
ï^íKõ?A  å3æAõÀí õÀíXé^ä|å3æ¶é^í3æ¶é[ÿjü Ap íøHÈépí%>Àé J'¶éðý 0ùú
û
³ ï0ë æ¶ém€
 C ï0ë é^íþ ï3åóAéjökï^íKõ?A å3æAõÀí ñKíXém€
C ï0ë épíïÈø^ùú
åóÀé F  ï,ë æ¶é æFø À' éðý } A' í è } þ JA' íKè } 0 ùú
û  û  
åóÀé þ F  ï,ë æ¶é æFø X= å X ü } 0 ùú
þ
û 
äå3æKæXíKçéÈë åjæçÀå3æKö3æKó ú
ûû
î#épèXé^íý®íjæ¶éõXöjæFó ú
ûû
íKõXó ðé îíXéjï^õFö3æFó ú
. û ûû
éðï[ü ðï^êKçX
ó Aêï^èXé0ë å3æKí è¸äåjæKæAíKçéÈë å3æKíKó ë õ í* èXépèîåó ï^çÀí
û û

aQKN U 8 ƒ L 9%E4ÄQK K%9 adEHI QK?{|…V


8+NaQK ƒ a%G9 7%Ef9D0E7%Ef9v9KEH{|…V
ï^õ®öÌõ í%X > íKçXóÀépí  À óFíï[üKø, îÄt©£l t äIÿ ° Õé^è= í 0ùú
. û

 Képè= í íKõéjóæAí®é^è= í3ó ëÒí õéõXó  A þ  åKõÀêKí}í%> ë õépíïK è3æAõ è*=AèK½ õÀí í å3æKæXêKíKõä =AèKõÀí2
û
û û
÷1K ' ë í¸øÈï^õ æAí%À> éðø^ùÈù
û
þ åóÀé F  ï,ë æ¶é æFøÈï^õ ñKíXéðî#éðï0ë æAñø ù  0ùú
û

þ åóÀþ é F ï,ë æ¶é æFøÈï^õ ñKíXéðî#éðï0ë æAñø"Kù  =FïmH} 0ùú çÀèXépç?'
û   
øðîhÀ£ t>XçÀí¶é0ë åjæíKù/ ï^íKõ?A  åjæAõÀí õÀí3æl t ïÈï^åïÈøþ ž   &tX> çÀþ í¶ éÈë åjæõXóKï  èKçÀç•Kõ èyò)‚S
û ! û 
íKùú ôÈë æXè üDë ôjøÈï^õq öyæFó ù þ p
 ûû ûû
 éðï[ü
j  ï^õ ç åKõÀíø^ùú
û
þ çÀèXépç?Ñ ' øðîhÀ£ tX> çÀíÀ éÈë åjæíKù
 
ï^õ®ökæFó ú
ûû 
ë ôjø^õq öyæFó ùj  éðï[ü#  õ ç åKõÀíø^ùú
ûû û
çÀèXépç?Ñ ' øðîhþ À£ tX> çÀíÀ éÈë åjæíKù
 

©Kamal AOUDA 2005 www.kamalaouda.com Page 148 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

õ®ökæFó ú
ûû 
ë ôjø^çÀå3æ q ökæKó ù
ûû
éðï[ü#çÀå3æ ç K å õÀíø^ùú çÀèXépç?'ÑøðîhÀ+£ t>XçÀí¶é0ë å3æ®íKù
û  
çÀå3æÑöyæFó úþ
û û J
åóÀé F  ï,ë æ¶é Fæ øT=Aå Xü } 0ùú
û 
åóÀé þ Fï,ë æ¶é æFø  T'¶éðý } 0ùú
û  û
åóÀé þ ç åKõÀíø^ùú
û 
Fó = ë çìXå3þ ë kë æKë éðø^ù3Té 'Fï^åX÷NõîDíï[ì X í éTt>XçÀí¶é0ë åjæ1
û û
éðï[ ü H ðï^êKçX ó Aêï^èXéÈë å3
æ Kí èÌõÀå3ó ï^çÀ í K í KåjæKæXêKí
û

‚
4 QKuEJ9%xEI K?I EH4E xN K9?Ú  K I EJI 75 4‚QKuE9%xEH{|…V
U 8+N{s¡7%Ef7D©Q` Ga9 |FI K I E4¢E xƒ 5 Q Qj`^?{JOmm7%g%7< aQv ^Æf9KugÆ mUM%adÆmi©`EfQª0Q Q5 O\|…V
çÀèXépç?'Ñøst>XçÀí¶ éÈë å3æ®íKù

éJ'Fï^åX÷ æXíX÷
8‡ ]   e€ "?!  
~#I Z Ñ( ??
Z~.ƒƒ¨§ Õ
Õ~Õ


f   *1 . / 5   /
 &   ?=>=) œ/ =) 
 ‚  .*+< ## ; 
 ]! >1
 =) "$
 
v
! >] ”I € *1s

ª(£ §%‡·H¬¸ Æ ©:Öf c*1


#…*( €
 *1 *š[",
 €
 ! @ 
 ?] ! d ##c
 "?  
F 


 I †  
 =.?: ¥;xI
8‡ (]   Z
 49;2   @   @  N  ? NÍ_(
\   *1 .4
*1
#; ",
 €
 (, 5"ÉH
 (
1 
~) H=.!  ]
 .N  > #) 
 "? h 54] 
9
*( € Ì "H  ] w#"? @  N   w   !w  Ó >=.*( "? Ó   ",
™
 ! @  N 
 


  ",   @ 
? N !    ! 
\\ 5!  1",
 
"B  4
  Z
ƒŽI
ª(£ § ¥¨ ©rÖ T*1
#q*(€
 *1
*î:",
 €
 c !"H  ]   @ 
œ ?] ? pd #… 5 #
 
• ë
  
 I!f(] 
 !=.!  , xI
j“, N _(  \   *1 .; . @  ; +] 
= ¥2I
ª(£ §
:£¸ ¬)Öc î .*1!Ú^ !  > .? .±*( €
 *1
* U*1    !
", î
g#
"
 #g
 
• `
",
 €
 +;
 I 
?? ;"?1   &

 ;€ "??  4 , Z  #
I +] 
•! =.,
v
~.çØ3Hƒ",)#  49
\ 5*4+ ?=) 
 I

k g D!>]
  ^ðf
.   &i g=#*+ 
#gl ¡"H
 €
 ‹ ] 
"‹ l*+ $!
D" 
!~.ƒ  
‚
v

. ] @  a
;? H )"H  #"? @  a [*+  $!
/N 

  @  /9[
 ",
 €
  
Z @  
`
 9… a",
 €
 a$?_  @  I N 
  … …*4 $
F" 
!~.ƒp *+ )&
 ! 5Á ”&…F

/#
"
 #f ",
 €
 
 @  N   /

 ?!d ./#  =h=#
"B .
 9
 /?]  /# @  d .I
‚
 T
.
Z.*4*+
p

  :…=#*+i q",
 €
 c"?   ç”"œ T#]
 ! 
a
c T

 N 

  ",  1)  @  44!;
  @  
=.! .+4",
 €  \  
 
  
I

©Kamal AOUDA 2005 www.kamalaouda.com Page 149 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 ",! .  ð*(",  ! d ##;",,=) Z
#  •.
 "?! 5*(  @  *+!   (",
 €
 
;

/ [
 /",
 F [
.
Z.*1*+ 
. f

  [  1=#)*+”IJ‡ h 5F",?=) Z
.  
!(=.  Z
 *+? 
!+ -=) "$
 !>] ×I €
*1? 1
  \ +.*+< ## ^ 
 ]! 54s

#¤ ©ª(¦ Æ ©p´£«¥
¦« © ¥Ð֐ K?D] 
1 , 4 Z
 ¡9¡ #) P S",
 €
 D , 4"H   #


",*1*+


~# 
 "1   Z 
 9a a#
"
 .  ƒ    / ,  "H  ]F 
?

(   @ 
H ,  
 ) 
91"? 
B1.*+< #;#*( ]  Ì 
   ðf *+ ? ”I
¤#©ª(¦ Æ © p´£«¥
¦« © 1¥ f¸ ª+© ¦¹!¬pÖ !=) 
 !
", / / .*1  ]! @ " ! 
 ",
 €
 

 "H  ]   4? ",   .
1",*4*++


;~5?+] 
 =.?  H Î
2
2 ƒŽI
¨ ¦
"» p´£«¥
¦« © ¥T֕ . @  ?] 
 , ‚ Z
 F9 )&ð*+", BŸ.! .…
 / 5"?F… 


  4  ! 

  ",   @ 
B4

  ;",
 €
 I
`
 =) "$
 ‚ 
 ]! K*(? .[",*4*+! BŸ), .Ê  !.*+< #  

*+ # " ç ? 
 

=) "$
 !>] ”I € *1 I
Aèï^è3ý®íXé^íïJ} ÝsÝså

æAè3ý®í}ýÑè%>ˆ çéÈë ìXí È æXèý®í}
 
ìXè óXí}  ìXè óXí} TAèï^è3ý®íFépíïJ}
 û ®  û 
Aèï^è3ý®íXé^íïJ} æXèý®í}3ý®è%>‰  í È æXèýÑí} ìXè óXí}  ìXè óXí}
  û   û ®  û
JXèï^èý®íFépíïJ}

Aèï^è3ý®íXé^íïJ}

æAè3ý®í } ýÑè%> C èjë é È æAè3ý®í}
 
ìXè óXí}      ìXè óXí}
 û
 û
JX èï^èý®íFépíïJ}

 èï^è3ý®íXé^íïJ} æXèý®íX} ìXè ë  èXéÈë åjæ%
A À óXíï[ü 0 æAè3ý®í}
  û 
ìXè óXíK } õÀí íKçé  ìXè óFí}
 û û
 û
JX èï^èý®íFépíïJ}

 èï^è3ý®íXé^íïJ}
A

æAè3ý®í } ï^íýÑåXìXí%ˆ—A= è3æ%K å3æXí  È æXèý®í}
 
ìXè óXíX } éðïÈóXí  ìXè óXí}
 û  û
JX èï^èý®íFépíïJ}

 èï^è3ý®íXé^íïJ}
A

æAè3ý®í } ï^íýÑåXìXí%ˆ—A= è3æ%K å3æXí K ÿDë ý®í åóÀé ÈæXèý®í}
 
ìXè óXí} "   ìXè óXí}
 û  û

229
Basé sur un tutorial de Christophe Jollivet, publié à l’adresse
http://christophej.developpez.com/tutoriel/j2ee/pooltomcat/

©Kamal AOUDA 2005 www.kamalaouda.com Page 150 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

JXèï^èý®íFépíïJ}

 èï^è3ý®íXé^íïJ}
A

æAè3ý®í} K å ñ?ˆ‚=AèjæKåjæAí  0æAè3ý®í}
 û 
ìXè óXí }XéðïÈóXí  ìXè óX í }
 û  û
JXèï^èý®íFépíïJ}


5.2.3.3 Procédures stockées


` `
 Q 
."?  # GH 5"ÉH  L",!  
 ! /Q",

MÒ ~
# ƒ)",*1
  Ief   Q )*+ > .?
`
^! €
"! .+ R# @  d . r",*1
 €  rg R , #) "H  ‹fÒ # Z
  <#*+! 1?    !
 
I
JK! . #*+! •?€/# @ d . 1  *1
  
&  
."? 
# 1, 5"ÉH
 #   ! •  a
!
`



 
I 
•  -
"  "$ +
4  ? +
4 . 5 .• ;",
;Ò 4"  ! ] .
v
 :!>] 
”I #"? @  N    a?! Ê",!>]
 a
!… r
!:c


 a?c
 [=.*+
v
€
"! 5
 &   ?=>=) œa  ;
  
 ",*1*(/ =#. œ ] 
"
 =. "H  
 

."? 
#+
+
4 Z
 Z4, #) "H  # I

Ì  N  , 5 4*+ $


 \N  Ÿ# 5
&
  4
."? 
# \, 5"ÉH
 -?? ",
  -#
"?]  
.*+< # RI! ! ##
P 4L# 5
) ; ‹] 
5D¡?5  I-J‡ C *( 1L# 
 #
",   .
 *+!  4 .=) "-! #  ;"  !   1!>]
;  *1 5!   -

  (
"$Z
 
?€(
  \ (
.
"? 
. - 9 
5+.*+< # 
I

â  5…Ê   
. @  T N €
"!  [N 
 q
."? 
#c, 5"ÉH
: , A
 ….
  @  :"?  
‚
N 
 Ú# @  d .Ú)*(  #"? @  N   Ú
. =) .MÚ ô

 ?? "?MQ>] 
 @ 
+ ,
Z  . *+! *1 ?€Q!  @  M M
, .Q"  ! ”I 8‡G! #C ]! 5
ZC L
."? 
# 
, 5"ÉH
 (; #. 9/ 1=."   . ;*1 !;9^Ÿ.
 ;

  *+! ”Ief1=h=# •."? @    ",

`
Ò  , š"?! #.  !   w*(
 =) ",  ˜
> 5
 ˜9y y
."?  #w, 5"ÉH
z??
! 5*(  @  *+? #  #"!! .
 \   5(  -"  ! 5 @ 
? N 
   ! ”I


i
  -
 g
."? 
#T, 5"ÉH
]
 Tb
kÊOœJ&‡ =.! ! .
 -
 g# =# # "?] .q

v
  Ÿ# FÐ h_
 šJK  
 œ 5 .*+! …c !  ! .*+   #MÚ V*+ $
Ú
##JK (
 !  ! .>=.
"?JK
 
"H  I J‡ > .*+ $

#
Ü, •
 !.*+< #;4 h_
  • ) Z @ 
?",)#  
1*l   
."?  #+, 5"ÉH
;
#
"?  +4*( " 1",  I

©Kamal AOUDA 2005 www.kamalaouda.com Page 151 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

â :
# !! ..[
!: r# , .q"? h .!
"H  q
:€ *1
   *1
  , 5r
^*(! ##
‚
",*1*+? 
  ‡
 … 5"? 
#FH 5"ÉH
9c5  b
kÊOœJIœâ‚/#]
 .; 5! .!=. 
 
  (
."?  # ^, 5"ÉB
 \ ] 
"-
 \+ 5  ^
+ 1!
"B  +7I Î

f…Ñ^_ @ 7I 2  [ , ) "H   


 ]! . [ )*( > .? Kc"#
A
 
.", 
#…, 5"ÉH

` `

 
[Kòèõ kK8 jhe~.ƒŽI•J‡ F , ) "B  ?! ",?=.*+ 9: :)*+[Ò s 02
2
Î
vv
@ 
H , !? ?!    !
4
!4kÊO0I
`
"#  .;
."?  #1Kò‚èõ kK8 jhe:~.ƒ
` `
` vv
Ke eœJðFK8 jhe‡Ihâ Ì Ñ1e^kK8p& J Ì {e‚Ihâ Ì Ñ1e^kJ Ì {e
v`
{è+ÑlK8 jhe‡& J Ì {e
vv `
õròÊeÊeFK8 jhe‡I K8hkjhkw¥ J Ì {e‚I K8hkjhk
vv
.?_;â Ì Ñ1e^kK8
` `
 
."? 
#Kò‚èõ k8
 jhe~.ƒf!.",*1
 
 , 5
"ÉH
 
;  !  


 
vv
",*1*+c
 Ÿ# @ 
 ? d #a
  a=.Ü, *1   #a9: ! 
 ^! 
 :*+ $
I 

`
` v

  •Kòèõ kK8 j“e~.ƒf9>  ;b
kÊOœJR H=.! "#
f
1 Ÿ# •JK  
 
œ 5 .*+? ”I
` v
N  Ÿ# \JK   
œ 5 .*+! ^",!  ! - ! 
 f^ ! 
 g
."? 
#‹ Y‹ ¡
."? 
#‹   ç
*+d*+I•k‚/ ",
F" ç ??
&   , )"H   ! #/"?", 

   !  …
.
"? 
#
`
, 5"ÉH
IÒ(  4) ] # ",! ##é  ¦~Ԕ", HKòèõ k
K8 jheÕº¦‰&  Í .

 ", + , ) "B  
` vv

+ 1",
1Ò   =!    !  
!41


 +

   
."? 
#4, 5"ÉH

` `
*1*+
CKò‚èõ kK8 jhe~.ƒ'I M*+  $
C!€ 
"! . Ò( >_PÐ N  Ÿ# ",G#?] Ð 
vv
#  
 5    
."?  #+, 5"ÉH
+
+
1  
 .f ”I
`
JK  
 
œ 5 .*+! ",r  ¥ "H
I“
##JK  D~ ¦dԔ", Hòèõ kK8 jheÕº¦)¨ƒ §
vv
  
 . .r  ¥ "H
I € 
"? 5
Ò( >_ ~.ƒ §

5.2.3.4 Prepared Statement


`
 . @  N 
 # @  d .14 h_  ;œ 5 .*+!  , €
"!! 5
 1Z ,  
 #1 !11


 

"  "$ 1()) <#;
 1  \ .  \ 
 ]? . 1s
.  Z1 (# @  d 5 +
] ) =)  @  N    +#   
"B .!  1H_
? 5 € I
v
fð .?]   *(   
 Z
) $
*+;
=h=#
"B   # "$ #"$ I
ðf.?]  N *1
 "?*+? 
 + €I
ðf.?]  N *1
 "?*+? 
 ^ 5
   I
ðf.?]   - # Z , #*+! 5 @ 
,# ? ?€(") .<# ^   # @  d .I

©Kamal AOUDA 2005 www.kamalaouda.com Page 152 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 "$.Z ; . ] !Z
#
/•"? + .  ; ! d ## 
 . Z7Â", ?€# @  d . 


#
",*1
 
 q
 
  ## D• 5 .*+! >q ‹ …Ÿ..Z
r ‹
! qg


  I
` v
. @  S"? ¡# @  d . ‹?! 1€
"! .
 ¡
 G
#*1 <#D=. R   g?! 1",*1
 
 g9
 N  , 5r U# @  d . Vœ 5 .*+! )IcJ‡ 
! )&aW Y?€
 <*+ï9X W <*+ô=. U 
Z ,  
 #r
!


 : r  :#
",*4
  r

IÊj“!q",! .! .:r#
"$ #"$ 
 #
"H .*+! \  :
# Z , ##*+? 5 @ 
‚# ! A9R 
.:") .<#  Išefc=. ^   ## 
v
œ 5 .*+! 5c?? -
  
   = @ 
 )*+ ô % 
# #( &‹
 g# @  d .g
 =. T

5! .& 

    ! € "! . 
   
. =.   ] 
"   .*+< ##   =>=# #? 5 I

 @  N    ô",! ) 
 ! T9X N *+   .  î ï >=.*( "?  &:  V?€U",  
v
 
 ]! . \
 ] ? d #;# 

  1s
`
1, #) "H  #4;  # @  d 5 # H .   *+d*+  
?  N €
"!  (  N 

  ",  I

 /  /.*+< ##  a …# @  d .F"$Z? ~. / N € *1
 F" ç) ??!/  / ! 5
N  ! .).
Z
  \",#  ! ?€4.*+< # ^; # @  d . ƒ'I

##  œ 5 .*+? 
  .
f  ë¥;",I 
#.
œ 5 .*+! #~
v ` `
¦Ž8 k Ì  ð eaJ‡è+{{ee•[KeðF Ì e•j¥“æ-õròÊeÊeFJ‡è+{kâ Ì Ñ1e jhøeçæI¦)ƒ¨§
v

5.3 Optimisation de Mysql

5.3.1 Performance des moteurs de stockage


`
k‚+"? > .;! "H   4
# !! ..1.
 *+!  N #"$
 .
"H  #;/Ñi_ Ò    ) ?!
 N  > .!  (    (*( .
5\4H 5"ÉB
Z4  
 *1!"H     ( h=.*( "?  I

230
Figure 58: Architecture du serveur MySQL

230
Source: Jeremy Zawodny, Derek J. Balling, High Performance MySQL, O'Reilly, April 2004, ISBN: 0-596-00306-4

©Kamal AOUDA 2005 www.kamalaouda.com Page 153 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

k a a=) Z


#…7
x&f c", "$ [ 
 ) 
#[ =h=)#[
 /!>]
 "? a#   =./9 …Z ,  F 
‚
",
 €
 
&!; N ! $ !  =) ",  + ; 1!
" ) . I
`
a", "$ [ ! .*+   #",!  !   4=. "H  
  . ",*1*1
  ;/‚Š(OfkÊ¡~) 
Z @  
`
 )*+ > 5? K ….  Za  , ) "H  fÒ &T
.
"? 
# , 5
"ÉH
 
&",
"$&•!    5 # 
N !  *1 ?  ÝFƒ'I
`
˜ .   <*+™","$ ˜",!  ! ì  Ó*( .
5Ô˜, 5"ÉB
Z @ 
¡ *+ h .! Q
??]  Z
.  1


 ; F   ## .  H 5! .  IJÊN  , •"? h .", "$ @ 


 ! . # ?!+
-"? h .4!
"B # I
`
N  ! .>=."?:? #q :,€  <*+: A … .   <*+c","$ : , A
  Ì j‚   
! .c
v
*( . AH 5"ÉB
Zr?    ! I‡ef  !q",*1
!:N 
 c]
 Z 5  N  , ) "B  [r


 ]   @ 
f )*+ > .? pN 
Z A #
"H .*+? p 
^ q",! .
c :*( 5
.[
, 5"ÉB
Z
~#€ *1
 L# "
 #;N 
 l 5
 L N 
# Z , #*+! @ 
pC
 P" L
) *( #S


&
",*1*+"?
 ( .?
"H # ÝFƒŽI
`
 4
 *( . .-1, 5"ÉB
Z
 ;",*1*1

 @  ! 
+  4
+ ] 
"+  -! # (  4 . .! 

`
  T , ) "B  fÒ IAj“ c!‹",? .! .? ig# #r?€
   @  N   T.
Ü, ] ! ig 
`
", "$ / ! .*+   #IJ*1*+/ *(! ##/ ;=) Z
.7
x&Ñ^_ fÒ ",?  ! œ
   
.;*( .
.
4, 5"!ÉB
Z @ 
? ,] ! d #( #.?"H  
  ^1!- #.?"H  
  
I
`
Ñ^_j Ì Ñ  g W*( .
gr =.! TXÑ^_ Ò Iqj“/N 
Z TN 
Y*( .
R

.?"B  
  @ 
B .  
   *+! ", Ü( ] 
"( N $?_
 $ < ! @     \

  "?  
=.! *(BŸ.) 5 #*+? 
B91 \ .  \   "H 
#I
`
S*( .  òÊe Ì ~.
  D? AÑ1eÑ-è+œÞKƒ
.
!D T 5
  rH 5"ÉH  ‹
• ` v
*+ *( #I c*( .
pÑ1efKŠ(e‚& @ 
 N 
.H) ‡
 
p F=) Z
#…7
x&c  . aBŸ.! .

a a] .  aÎI 0ÎI 07Ij“ *+ ‚=)  
   5
  aÑ^_j Ì Ñô ?  @   


 F!
  5
 I Ì  N  , 5‚cÑ^_j Ì Ñì"? ?€a*( .
.?? ‚ Z
 *+!
- #.?"H  
   I
`
c*( . Aj“
!kÊOTZ<#F  5
   #.?"B  
    
Ij“Œ . c ! #.

 ‚ F 

] .  +ÎI 0ÎI
`
:*( . AâÊkÊO‹" , .# …Z<#:   5
  a# >   / 
p
   
./!>]  5
I‚j“

.  ! #.

  + (] .   I.3 I 0I
­

©Kamal AOUDA 2005 www.kamalaouda.com Page 154 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 ï 5
  aOkÊO‚& @ 

N 
. ?!! ‡
 
Ê F=) Z
#[7
x&?! ‚H 5"ÉH
  
Ê 
• `
  @  1(?€\=) "$
 . I  
#*1 ”& @ 
B N €! .!   I =)*;&!, 5
"ÉH  1 =) 
  (
`
 4 5
 I +?€
 <*+4  N €! .  ;I + ",?  !   \


 -   ( €I
` `
.‹P S"#   RN 
 D 5
 &\ =.? ;  @  49LÑi_ Ò @  p*( . 4¡, >"ÉB
Z

!    !×IJ‡ q!c=. ii r
  … : , ) "H  !eâKŠ+jhâÊeD…ðÞ eF",*1*+r r*(? #
v
 N € *1
 4 
 ]! ”s
`
JAÊe Ì ð e/ð Ì O e/ ~)!jhâðƒfeâKŠ+jhâÊe ¥/jhâÊâè+kÊOà§
`
JAÊe Ì ð e/ð Ì O / e ~)!jhâðƒðÞ e ¥Ñ1efÑ(è+œÞU§
v
`
 . @  c c*( .
a, >"ÉB
Zc N  , ‡
F
#
" ! a[ N  , ‡
"H  ] &"!N  , ‡ F h_
 c
 =.! @ 
‚ , (!    ! D~”Ñi_j Ì Ñ\ƒŽI 
-"$Z+ r h_
 ‹N 
 r 5
 ‹ ͟.9D"#

&A œ=.?
` `v
!    ! ;",*1*( Ì ðe…ð Ì O e‚&",*1*+; ;*(! ##  N € *1
 + 
 ]! s
` `
Ì  ð e…ð Ì O e/ eâŠ+jhâ‡e ¥Ñiސj Ì Ñ§
` `
Ì ðe…ð Ì O / e ðÞ e ¥OkÊOP§
v
“j  , - *1> 5! iR.
  @  R  c 5
  Tq .?"B  
    :?! -
 T.
  :9
. . @  [  ; 5
  1 .?"H  
    
I•k[
    /!    !! *(  N   "?  @  F
*( \;*+ *( #;
  +*1 ! ^9Ÿ. ×I â‚ 5-   
. @  s
`
 a 5
  Ñi_j Ì Ñô?? p!  *1 !
 c
A 

5 .p éèëê ìFíîF",*1 ! [qù
2m
 N  .  \  
"H 
#I ef   \

 !  
  4 >=.*( "? ^ 5? @     .  # 

5(’\) .;# , .4( Ü,914"?  #"?! 5 Z!6×E'%'I
`
 ( 5
  ;Ñ1eKŠ(e:?    !! œ*( ?  ] *+? œ  ; ! .
.+4=) "$
 . I !€ *1
 /
 
v
5
 CÑ1eKŠ(e @ 
A",,] #M3,2S! ## ‹ 5
  D @ 
A , !    !
La3,2P .?
  
",?*4*+3,j2 *B3, 2 a3,2  ! .
.\(=) "$
 .+~'3,2(=) "$
 .\4


 - f3,2!    ? .
.
 ] 
";3,2-=) "$
 .^^ !  €ƒ'I
`
 4 .  4 
"H 
.?!  #<   ! . 4 ] 
";  + 5
  4 h_
 FÑ1eKŠ-e~)
  #

 c" …


 …Z ,  
 #qÑ1eKŠ(e‹
 p#",
)  5[  =) "$
 ./^ !  €a 
5
  \?,ç Ÿ."?! . ( ] ) =)   @  H ,   
 +
."$ +  1" # "$ ."$
 ƒŽI
`
 ( 5
   òÊe Ì ?? "H!>]
 4 *+ *( #Ief   +?!  ##< 1.
  1*- 4   ; 
v
 .  , .? 
\(",
\1
 ! 5
Z4(;#  *()5
Z4(!>] 
”I

231
Source: Jeremy Zawodny, Derek J. Balling, High Performance MySQL, O'Reilly, April 2004, ISBN: 0-596-00306-4

©Kamal AOUDA 2005 www.kamalaouda.com Page 155 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Ì ] 
"¡
P €P$
 $¡  
 l 5
 CòÊe Ì   P$! 1 Z# SS

  "H     
` v
 


# ?  T?? 4
 ‹ ! . 
I r=."H . (¡. !  ?!*+! ( , 4 .> # 
 
 Z# XX

  ",  È~.È ?] .!*+? l
.>  
 [9Ô Ç",.   .
ƒŽI‹â‚ 5
`
"? 
! @  S

 S S] .   I.3&+Ñ^_ Ò  

5 .L  S €  SOðÊee @ 

­
 )*+ > .? K#*+  K9:"? > . ? .
”I‚â‚[#!]
 . ] 
"a
 [ 5   

  + €(
+ 4!
"B  +7I ÎI ÎI

5.3.2 Verrouillage, concurrentialité et performance


k g D!
"H  g7I 0I 0I ÎlT ]T _! S N  *1"H - g
 ]  ?€‹N  ?   ‹ 
1  
‚
 >=.)*( "? ;  !  h_/  
I 
 @  "? > ./ _!/? f",*1
 < .&   , ‚
"? ?? #
v
F N .#?€/*+
",
  *+ 1 ] .
   
ZF!    ! ‚ a
!


 19a  @    
  \?! 


,! 
I
` `
 +*+ ",
  *+ ^(] )5
   
Z4Ñ^_ Ò  =h=# .! ! 1 ( h_
 +( 5
 ;!    ! I
k g  q 5
  Tg h_
SÑ^_j Ì ÑÈ 1òÊe Ì &p?
Ê ‹] ).
   
ZRl ]  r 5
 D ,
‚
v
 

5 . IìJ‡  
. îd #    ?! ï
Y  – #. .*+? 5 .  <  z ï 
", "
)#?    . ï V

  ",   @ 
=.! g*(BŸ.) 5 #*+? T
 /9Y V .  
N
") 
#I™è-"? ì N  , F
L Q",
SM ì
 
5  S

  ",  lQ",*1*+#"?
 
"H .
 @   @ 
,",*1*+ 4 N  ]^]
+
4 /5  ;Î+=.! *1
#!! -!  
"H  
&
`
 /^ ! !=>=."?*+! >
& /*(
 =) ",     ?5  
!
   ‚  " 
I  ; 5
  
Ñ^_j Ì Ñl?? ;
 "-
 -!  *1 !
 + "?4Z .4N 

  ",  I
`
  5
  F… h_
 rj“
kÊOg 

5 .! A [] .    
Zcq ]  :  Z Ie   F =>=)#! A

*+   
+ Z# D¡", "!
)#?    . S*( ‹   ‹",?*1*+! 1
 rS*+ *( # @  S  
] ).^( 5
 I â‚ 5(   
. @     ] 5\ 
 ]  4  Z s

f! 1
 R ! 5 @  S  T] ).rR 5
 D 
5 5! 1 . @  N   r?! (

  @  r9P
 
Z. 5  (; + 5
 I
k 
 ! ‚c
 < # #    5 5 ] 
"  # @  d . /Š-.
…O_ 5? ‚! ##…# @  d . @ 

‚
!",
   N  ! . Z.  . 4N 
 ( 5
 I
è(! 
+"HÏ! N 
*1 
 , . #  @ 
H ,  
 ) 
91", 
B i] .\( >
 I

J  c ”&  ] .F 5


 …?! Ê
 [ >=.)*(! 5 @  :  ] )./  Z …
[  
‡
",
\ 
 ]! >4s

©Kamal AOUDA 2005 www.kamalaouda.com Page 156 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 \ .  \; 
"H  .I
`
 R .  RG*(
 =) ",  P5 5? 1 
; R" l
#
" ! l~#",*1*+S"?   R
 N € *1
 1" ç) ??,ƒŽI
8 k Ì ðe/ 5
 %k*+1KeðF", 
*11¥ ]  (õròÊeÊea

 @  %kÉH_ ï
v `
kÊe eðe…{è+ÑD 5
 %k!*+-õròÊeÊe[

 @  %kÉH!_1¥ï
k *1
.?€(?",A›Š-è+8 Oލ   5! .; 4 5
 &!?^ "
 1 ")  .6×E)6uI
v
` `
 \! ## +
 ]  ?€--] ).
   
Z 
?  
  \
+Ñ^_ fÒ ?! s
`
 ;] ).…
 ]  a
Zs  
 
  

 @  *+!  ] 
"/   5
   h_
 cOkÊO
 
‡ >=.*( "?a H œ )  ! 5 #F…  5   F… c
Z…~#!*1
 a",,   [‚?€

   
.  Z  ?ƒŽI Ì ]  ";"? 4] . F", " #!    .  , œN ! 5? ‚
 +=. 
  @  
 4 5   4 +
Z \ , Z5I
` `
(] .  
Zs 
\ $
#   @ 
H
")   *1
#,€(! #  @ 
?  !! ”I
k‚\"?1",
  
] ).^N 

  @  ! ?€\ .  \N
"!) 
#4 !(?€( .  ^  
"B 
#I
`
 5
   7
ù#  
*+ F#    ! # F >=.*- "?&   *+
",
  *+ 4
;] ).
   
Z&
  +*( .
.^4H 5"ÉB
Z+  ;","
#?    . I

Figure 59: Modèle de verrouillage et de concurrentialité dans MySQL

K©¤)¤.¦¹
¸ ¨ ¨ £
»©
â ¦« ·¹
¤#©«!¬¸ £¨ ¸ ¬Â Ä£¤.»©4¥©+¬#¤.£ Æ£¸ ¨ ¦ ¬.©¹
¤¥©4²H¬5¦·.B£
»©
é é ê
` Ñ^_j Ì Ñ;& ò &
ð
  
 i=. 
  { 
 
Ñ(.Z
`
 Z -›•
Z Ñ- _ 
  Ñ- _ 
  j“
kÊO›×OkÊO
`
† .  
Z 
 -  ]
 ef ]
 j“
kÊO

5.3.3 Les indexes


`
 T 
Z   @ 
K€
 , 5! (? #l
r

 #‹ 5  
$
 @  D 4
 l
?RR


 
 )*+ > .? ;*1 ?€(",*1
##1"? @  +?!   + €  
I

232
Source: Méthodes de verrouillage MySQL, http://www.sourcekeg.co.uk/www.mysql.com/doc/mysql/fr/internal-
locking.html

©Kamal AOUDA 2005 www.kamalaouda.com Page 157 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL




? @  … N /? $ .…#
"$ #"$ K …
 *( .a/ .  
$ FN 
 [ .?
 F


 ; 5
  @ 
!",?  ! •
.< +Î
2*1    +N 
 
I
?1€
"? ./
 . @  d .",*4*+
`
Ke eœJÕ ð *i{è+ÑÐ
$ 
É^õròÊeÊe 
, k*+ ¥ !  .?! & Z H  
 #
!



 \!.1
  Z 4#",
)  5!+  -
# Z , #*+! >\  4 5
 4 ] !  # 5
) 
 D#  
 5 ”IpJ‡ h .r .
"$

 @  g , (
 T Ï
+  =>=) ","?Ief  ‹ Z.
D  r >=.)*( "? 9
*+  
# @    ;*1 #4N 
# Z , #*+? 5 ~)
5
 <*+1" 
?  @  4(è-~)!ƒ)ƒŽI
croît

k N $
 c . @  N ?
$ .[=>=#
"B  Ê
 c#
"!$ #"$ a
F


 #c
 ×&!
K

   
 4 #
"H .*+?  
 4Z.
 4 
Z  @ 
H",*1*+ "?!  ] 
"( *+d*+   h # @  
"?  […*^›”
# *Úc  .?
 :#
"$ #"$
IœJ‡:
   
 *+? K H f=."   . :p 
" 
?!*+!  
$  @ [ a
Z 
I‚j“ )*+ ‚:# 
 #…",   .
 *+! Ê :*1
#
 
Z \91",*1

 !”I
`
  € 
! ;


 4=. "B  
 ! œF [*+d*+F*(
 <#I f€ *1
 /  
v
?
$ .G=h=#
"H  /  l.
"$ #"$  S
 l.
 *+! 1 
/ Q
?PG # *—P !
`


  @  
1 €(9  ;"H 
 1",)#  
! .41!    ?!  N  , )"H   Ì ðers
` `
Ì  ð e…ð Ì O e[
$ 
É Ì kÊkrjhâÊkÊeET~) 
, k*+ ƒ
`
Ì
 #< l N €
"!  ¡P"? > .L , #) "H  &(Ñ^_ Ò "#
L
 L  , .S.


Sl 5l  

# *(\  4 5
  
$ 
ÉI Ì ] 
"(  ^ 5
  +Ñ^_j Ì Ñ;&   + €  \?! , 5"!ÉH \

 =) "$
 .9q5 p p##  a#
"$ #"$  [
 [.
  [~#/=. K  [ 5
 c",!  !
3,2
2
2   Z  
&   #
"$ ."$4!.3,2
2-=. +
 (.
  @ " ! 
 ; 
"H 
.4! @  !     6×E”E׃ŽI

“j \ ,  *15 5? Ð 5 @  M Q"#   G^!  !€  P",?*1*+Ð  ",
G^!   
"?
*+ *( #1
1 /
!;
;


 
Ik
 1 
•*1 !;9^Ÿ.
9"$ @  *(  =) ",  4 
5
 6×Ež ! •Z*+? .‚  .*1
"? ?? #F
‚.   !œ 1 .  1N
") 
#Ik
"?F=. )&f 
=.? @  : …"#   F^ !  €  ? Ÿ),  =
… @  :  /", 
  ?€ @     a  
?! 

  @  \? ? ,Ÿ) " !*+! "$    
I

è(! ##š ì"?  ) . Ð Q#


"$ #"$   &  Q €  Q )*+ h .! F Z
 *+? /N !  *1 !… 
 >=.)*( "?+ ^ .  \ 
 ]! . 4s
`
 #4 +  Z  \
!\I! ? # i 5
  ( . @  N   _(4
 KŸ. ! 
#  I

233
Source: http://www.manuelphp.com/mysql/mysql-indexes.php
234
INSERT , UPDATE , REPLACE , or DELETE

©Kamal AOUDA 2005 www.kamalaouda.com Page 158 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

ðf.?]   i] 


5+Ñ Ì p~.ƒ• Ñ1jhâ‡~.ƒ
(
 1", 
 I
ðf) y Z.
 y
    Z   
 
  5
  ~#€ *1
  è(ÊkÊe OÞ
ÉH_ k> k•3 &“ÉH!_k> k
0
ƒ'I
` `
k‚4Ñ^_ fÒ  H€
 H . 
   
.i h_
  \N  €   I  +
 +?    \?! s

© ²¸ «¥©§ © ²³£¤5¬¸ ©¨ ² ֕  / )*+ > .? [# 
 #…  @ !  . F[*+ *( #a"H?*1*+ 
ß
i q"#   … c €  
I Ì     …N 

  @  i N  €…9: 5c  …",."H .<# 
N 
*^›” # *Ð ! H œ!
?  
  / N 
??" 9",5 5 4",."H .<# +?
 *+! )Ik‚
 N € *1
 C 
 ]! ”&(!
 L    #*1 .S"B . >SQ # *Ó?! !    ! L
F 
­
"#   (; N  €I
` `
Ì ðe…ð Ì O e[
$  É Ì kÊkrjhâÊkÊEe T~) 
, k*+~ ƒ)ƒ'I
­
`
Ì 
#< [ N 

  ",  ac"! p €c
 # @  d .c",*1*+cKe eœJ ð *1{è(Ñô
$ 
É
õròÊeÊeU 
, k*+ ¥ ! b!"É? I ! &1# 5
) .Q G#  
 5 5P",*4*+Lb!"É _& b!"!É?    &
b!"É?  &?b!
"ÉB
? I ",!! @  !   =..1€
"? 5
 ^N 
 ;# @  d .;
# 5 ) 
v
 #  
 5 >
#
" ~”j“•N 
Z A
 "[ .?] \  q? !  :T",*1
.*1 c! #‹ 
*1
#rR# @  d . :9g€
"! .”&A T .*1R. !g -  @ !  . ‹
D*+ *( .
",?*4*+
   ( €ƒŽI
`
© ²S¸ «¥©§
© ²Pª1¹
¨ ¬¸ ©ñ·,¦¨ ¦«
« © ² Ö+Ñ^_ fÒ  *+ 1N 

  @    l €  R9Q
   
.
ß
", 
  
I
e€ *1
 s
` `
Ì  ð e…ð Ì O e[
$ 
É Ì kÊkrjhâÊkÊeET~) 
, k*+&H=) 5, k*+ ƒ

J‡TZ
#TN  €r )*( N *+   #^",!   .
 *+! \ q]
 . ?!TN €
"!   
# @  d .  @ 
A> .! +  + 5! . D  g", 
  D €
 D~.
D ##l!€ *1
 l"? 
`
 €  g

 ! 4G
  ¡ >=.)*("? g ]  "D
 G# @  d .l",*4*+lKe eœJð *
{è+ÑP
$ 
ÉÊõròÊefÊe[ 
, k*+é  ¥! b $" ! Ì âÊk[=) ., k*+é
 ¥!  ö!#   ! ƒŽI
v
fO  r Ï
4  , +
,  
 gR",*1
  4  ‹ € ‹5   q ]  "r  ‹ 
€  ‹*1
  ç
", 
  +
# 
 #;  @ !  . 4;*( *( #4",!?*1*+
 s
` `
Ì  ð e…ð Ì O e[
$ 
É Ì kÊkrjhâÊkÊeET~) 
, k*+~ Žƒ &H=) .H k*+~ ƒ)ƒ
­ ­

©Kamal AOUDA 2005 www.kamalaouda.com Page 159 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

© ²G¸ «¥©§
© ² ß Ö1  l?! /!    ! G F  G#
"$ #"$  lS .!€! .Ð ! . Z.
ß ÙÊß
ß ãhð `


 @  *+! Ê ]  "…   5
  ˜Ñ^_j Ì Ñ1I !  € # …!…=. ‡ 
‡ 5? .T r .Z
p 
", 
  :T h_
 gJAò Ì p& †fÌ KJAò Ì M ðeEð‚IAef‹#< Z rZ  . &p œ=.!  5 Ÿ.
.
`
`
"$.Zf  +


 (
!;
 ; 5
   ]? / 


  @  f  ; €   {8 ðeEð‚I
`
ì. ?L H @  M Q"!$.Z*+? / F N
") 
#G
L
 L 5
 C ͟.9ì !€
Q
`
`
{8 ðEe ð[ ?] ! d #()*( *+?  Z

I

5.3.4 Concordances entre les types de données


` `
  h_
  /a


 /
ab! ]n ‚:Ñ^_ Ò :5 .? Ê
a  F*+d*+ a*( IgJ‡ 
",! ??] ?  4)# .+
;  "$ €1 - h_
 + 


 +!?  
 1
 ]  1
 Z

Z…
.
Z.*1*(   @  N c
 ]  [[‚Š+OkÊpIœ•  / h_
  F"$   [ …?! p

", ",.
! >
&   + ?] !
] 
 
 -] ) 5
 +?
#"?4+ Z.

  ( - >=.)*( "? 
I
k ; N 
 € Î&+];#
.

  ( 5
  ?€1",).  
 "? @ 
  )*+ h .?
‚
?€4 @ 
   -1 ]  
 *+! (=. #+=."?19  )
 €
 . 19  @    ;  
-?! ??] ?
",?=).? .
 P 5 @  N  N 
Z P #.?]  l @ 
 ]  "? l! ##Q  R h_
  P!    ! P
`
Ñ^_ Ò  "??€4!    ! +!b! ]1  N Ì j?b
kÊOœJI
v

5.3.5 Les procédures stockées


`
 c
."? 
# a, 5"!ÉH
 a?! ÊT?]    =. "H  
  . c ! .

 . a
c c] .  
`
7 I 24 Ñ^_ fÒ I Ì 1*(*(! Ë1!\ ](#  Z
1"?  ?? &"? h .(] .  + 5 ",#4
`

$
!;1 . , )I  1
."? 
# (, 5"ÉB
 \=. )
 ?!! •
4Z
 4 >=.*("? 1#"? @  
`
*( D^ !  ?=.)*(  D?!
"$Z
 ¡? #C S!>] 
  G"  ! ”I L#] .DC 
*+ 
   ¡ , @  S l"$.ZDR #. ] Kg!>]
+Z*+? .S#"? @  N  ‡"?! .  !¡
` `
€
"! .F 5! Ê …",
…fÒ I  /  #  /
a   @   a  a
."? 
# , 5"ÉH
 ?!
!    \?! s
k  1

  ",  ;"  ! . 1
") . 4
1 =>=# #! 5  Z

Z ;  5 )!  
 =>=# #? . 


  .=.*+ î~#"?   ?ç”"a?] ! g?    !   U 5"? 
# VH 5"ÉH
 V",*1*+± !
N  ! .."H  ƒ'I
k  P

  ",  PËÐ  P .  G F  P


 S #. .
 C[  L
."? 
# 

, 5"ÉH
 ?? ‚",?=) !     ~)€ *1
 F 
‡ F  .FN 
 … @  …  a
."? 
# 
, 5"ÉH
 … *+ h .! ‡cN 
? 
# @     c?    ? 5
.c! ! ‡ "
…
"?"?< F #
"H Ê?€
5
  ?ƒŽI

©Kamal AOUDA 2005 www.kamalaouda.com Page 160 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
k TÑ^_ Ò 7I 2g  q
5"? 
# c, 5"!ÉH
 q
"? ?  .! \ ‹"#   N 
: h_
 Tq 5
 
‚
 
" i
  Ð
." I4JK > .P 5
 C H "#

G? 5*(  @  *+?  .! / !  , 5    S
`
Ñ^_ Ò 7I 2*( 4 , , 
?  
 1;",?] 5   *( > ##19iŸ.
 \ 5
  - ͟.9 €
 , 5! . - 
?
$ .a*1 Z.fN 
] .  ! . ) 
#F~) [
."? 
#/F*1 !/9+Ÿ.  , •
") ./
 5 B9 N 
# ?!s $! h s ›>›.]I“*^_ @  I ",*^›#
" ›)*\_ @  ›5=)“›”
Z.
 Z
ç)Z.! >ç 5
  
I“$! #*1 ƒŽI

J *1*+gq N  ]c
͟.9q]

q r!
"H  q7I 0I ÎI Î&ì  q
."?  # …, 5"ÉH
 c??
K
`
"#

 : ] 
"q g",*1*(!gJAÊe Ì ðe è-JAekÊ8pÊe‚I 
^
 f!q=. A9D N  rR 
`
` v
",*1*(
;J Ì I

Å
«!¬5£ § ©
Õ
JAÊe Ì ðe è-JAekÊ8ÊÊeF k*+;~=È>.*+ .~È5&>IhI>I ÌBÌ5ƒ
v
ȓ"$."B .) H  "+I>IhI ̝.?   %k
 _

`
   , .[:.*+< ## /
  ! #c#? $ < !  , ‚
  Z
 5 #I•à!  ! _F:
:.*+< ## 
&

    , .(]
 4
 d # @ ! *+d*+ ?    !
 ~>] € *1
  ƒŽI
`
"#  .;
."?  #1Kò‚èõ kK8 jhe:~.ƒ
` `
` vv
Ke eœJðFK8 jhe‡Ihâ Ì Ñ1^e kK8p& J Ì {e‚Ihâ Ì Ñ1^e kJ Ì {e
v`
{è+ÑlK8 jhe‡& J Ì {e
vv `
õròÊeÊeFK8 jhe‡I K8hkjhw k ¥ J Ì {e‚I K8hkjhk
vv
.?_;â Ì Ñ1^e kK8

œ#*1*+œ
  .
"? 
#;H 5"ÉH
;1"$!Z! +",."B . ) ,  @    &
 B=.! •!    !œ 
v `
," *1*(
 Ì ðe è\JAekÊ8ÊÊe‚I
v
Å
«!¬5£ § ©Ö
Õ
`
Ì ðe è-JAekÊ8ÊÊe k*+È“"$."H .) ,  "+I>IhI Ì
v
"$."H .) ,  " s
â Ì Ñ1e[ !’\*+
`
ñ Ò KeœJA8Êpj ðw Þ Ô'kÊe{j“âÊe ñ jh⠆ è+øeà Õ
ñ J‡è(Ñ1Ñ1eâð/, #) Z


=h=."?
 ;
."? 
#4H 5"ÉH
&   =.! !    ! ;",*4*(4.( 
 ]  44?1*;I
v

©Kamal AOUDA 2005 www.kamalaouda.com Page 161 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Å
«!¬5£ § ©Ö
Õ
kÊè è-JAekÊ8ÊÊe È.jh{eEj œð• Ì  k*+
v…v
`
F
."? 
#9 
 ] #!
•
  
 
."?  #, 5"ÉB
9F>  • b
k‡OœJg , 
") .

+ 1!
"B  +7I 0I ÎI Î



 ;/  5  ; 
‚    
."? 
# 1, 5
"ÉH
 ;", 
 .‚ 
"
*+? 5 #   
 
 
v
9  N 
# ?!s $? > s ›h›#]I“*^_ @  I ",*i›#
" ›”*\_! @  ›5=h›#H ># 
çñ
.
"? 
# ç)H_
? 5 €I“$? *1 I


5.3.6 Optimisation des requêtes

5.3.6.1 Rendre les requêtes SELECT … WHERE plus rapides


`
N !    ?  U ï €  ï# H .YW  ± È*+   
#ï .
"$

 @  X
T!  *1 !R  
`
 >=.)*( "? P C# @ d . PC h_
 ÐKe eœJð‡Ý:I(õròÊeÊe‚Iâ‚ 5C!   
. @  
`
Ñ^_ Ò   
! 
   
. !    5 #  @ 
  *+ > .?  
 ]
#
   #<   N €
"!  
a"? # @  d .  
a"H*1
##…   #. .*+? 5=h=#
"B  /) <#…
 I *1"? 
v
!    5 # +(?]\" .•s
`
¢  à Ö9… !  N eE Ì jhâp& 
 , 
?  
 N  !  =) K  / €   9FBŸ#! .K

• ã©ð ß ë v ` `
"?"?  #   ",*1*(  Ke eœJðT~)

   5  ;  Ÿ# œN eE Ì jhâT]
   .
` v
 4  .4 Ñ^_ fÒ 9 N 
. ?!s $! h s ›h›#]I *\_ @  I "H*^›#
" ›)*\_ @  ›>=)“›€

  I $! *1 ƒ

 à  E Ä Ö"? A!    5 #: _! Ê, 5"!ÉHT q" :: , ) 
!  … F 5
  
• ß%òóã ß
ã `
Ñ^_j Ì ÑL fOkÊO‚IÑ^_ Ò !    !/  4" +  , ) 
!  

" 
 @  ?.#
  \ 5
  -
 ] ! d #. ?!*1

 4 .- ‡Ÿ. ! 
#  @ 
! 1! =>=#
"B  ? 
- 
•
 
` ` `
",, 5! .T~)
^
 [ 5  [ 
 Ì â Ì Þ‡‡eDð Ì O e‚&œ]
   .^   .‹Ñ^_ Ò 9
 N 
# ?!s $! h s ›>›#!]I *\_ @  I ",*i›#
"͛)*\_ @  ›>=)“›# _!ö ç 5
 I“$! #*1 ƒ'I

5.3.6.2 Performance des requêtes SELECT et ordre des jointures


`
. @  N 
 ì# @  d .ì> .Q 
[
   
5S 5
   &; N .#Q
C  @  -"? S 5
  P?!
#",
)   , 
 =."B .
 @ 

=>=#
"B .F #
"B .*+! K   >=.)*("? 
I ‚€ *1
 F
!
v
 a# @  d .F ?=).& ?=.! #",
) ‚  5
 /", 5*+œ ]!   5
 .f   5
 F# Z 
~)  
! =) H  5! ;#   #4(H ) "B *1 
 *1
*G  !*1
#+N 
# Z , ##*+? 5(#", )?ƒ'I

©Kamal AOUDA 2005 www.kamalaouda.com Page 162 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`

AÑ^_ fÒ  … .)*1   F: N .#[
a  @    ± 5
  /
 ] ! d #[!"H

 
v
 N  , Ê
/?   *1
 : #"? @  N  
 ”&…
#  
 &f !  =)  5! . a  /",*1
  ?

?  
  
IAJ‡ h .¡ !  =) ",  ‹ , i ##< ‹ !  ?! .¡
+  r# ??
."? q \",?*4*+

 ¡P .*1 @  Q N €
"!  SQ Ð# @  d .G   çñ*+d*+I1ef¡=. / N  !  =) ",  S 
",*1
  ?S
?  
  S ! 
##rŸ) @ " ! 9P0ùl=. S
 DS .*1 @  N  Ê=.! 

€
"! .  # @  d .!6×E)ouI
`
Ke eœJðF", 5*+×I“*+&!.”I 
 .%k
 "? & # Z I“*+
{è+Ñl"H 5*+×&?.×& . Z 
õròÊeÊe.”I "H 5*+ k ¥ "!, 5*+”I“ 
Ì âÊk:", 5*(”I“# Z  k 
 ¥# Z I“ 
Ì âÊk:", 5*(”I“*+é  ¥! ‚BŸ. ö+JK*+ !

J‡ a ”&• K# 


 #…   
N €
"!  / /# @  d . 5 5? f 
K
   
.; 5
  
&
 !  ."?    *(
 <#4 
 ]? .s
` `
8    !i N !    5 #rEe Ì jhâC
p  .*1  i N .#:
c  @  fÑ^_ fÒ !",
 T  
v
5
  
I
?"? .# N  , 
+!=>=) " ! ”& +=.#"?9 ?",
 •  - 5
  (
1 4.#
#
" +
!    ?! g N  , ) "H  Uœðf Ì j Š(òð^k b!è4jhâ™~)r€*1
 ï /U€ "! .± X# @  d .
` `
Ke eœJÙ ð *a{è(ÑY 5
 3œð Ì j Š(òð^k b!è+jhâÐ 5
  0‹õròÊeÊeMIhI>I‡=.#"?¡Ñ^_ fÒ 9
!",
  + 5
 3i]!  4 5
 40 ƒŽI

5.3.6.3 Query cache


`
 Ò( >_","$ !6×E)t‡??]  Z .F  .€? .N 
 # @ d . ] 
"; F#  
 5 @ 
/ . #?] _
/
`
+"  ! ”I?
  # @  d . !  @  1 , 
 
  1 
 .&
Ñ^_ Ò # 5
).  #  
 5
9a5  œ","$ /  N €
"! .‚ a# @  d .9a?]  Ij“  ,  *1> 5! F . @  
 n","$ Ô¿# @  d . Ç ¿# 5 ) ¿
W X


 Ȁ

 #
 Ç!#"? @  N  q ,
H_, . *(  @  *+! =h=."? +9;"$ @  -=.  @     ^


 +*1 ! \(","$ +,! *(
 =)
 
I
J *1*+¡‹ N  ]:]
r
‹ l5  
K  D"?"$ R , -€! #d*+*+! (!   ¡ . @  ¡ 
­
",! .
(  5
  -"$!Z  + @  N   _( 
 +! ) 4;# @  d . ( !  @   \9;€ "! .×I

235
Source: Jeremy Zawodny, Derek J. Balling, High Performance MySQL, O'Reilly, April 2004, ISBN: 0-596-00306-4
236
Le Query cache n’est disponible que dans les versions 4.0.1 et plus

©Kamal AOUDA 2005 www.kamalaouda.com Page 163 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

`
 aZ
 [ >=.*("?T ?] ! Ê h . #:0Î xmÈ
A=h=#
"B  p c.
"$ #"$  a  
`

  ¡", 
 6×E”ØI 
 @  SÑ^_ Ò    ¡"$ #"$ 1  R#  
 5 5TN 
 S# @ d .D
R 
v
","$ &
 Í=.. @   + 5€! .1;"?   ç”"H? h=. .*+!  !  @  19 "? 
BN 
 # @  d .
 ͟.94 . .
I Ì "
 4 =h=# # "?&?? ,*1  
#+?   &  N  ,
5 #
I
`
e € *1
 sA
4Ñ^_ fÒ   q?€R# @  d .  
 ]! . ‹ ‹?! + ‹ ?  @   ‹ . @  N  
N 
Z 1"$ #"$   # !!4
+ 4","$ I
`
Ke eœJð*Ê{è(ÑD 
 k*+
 
"H l*œ=.*¡ 
 k*+
`
Ì ] 
"4  1# @  d . +Ke e•Jðc ; ]  
 
œ ! •
#
" !N  ,?
$ . @   #  
 5 ?
*1 -(","$ I Ì   s
` `
8‡  # @  d .1",*1*+1Ke eœJðFÒ kJ Ì JAòÊe… &  *+{è+ÑS"H 5*+*( +","$ 
  #  
 5 ”I
` `
",! #a a# @  d .e eœJðÒ kâM è kJ Ì JAòÊeT &*+[{è(ÑÐ", >*+ F*+
v

+  #  
 5 (","$ I

ÃMÄ Ö  "B  ] œ ;Ò( h_;JK"$  B=.! ",?=) Z #• 4=) "$
 •*\_I "?=+ h ) 
! • 1] 

3i9  .
) . @  >_k",
"$ %k h_
 I

237
Se rendre à l’adresse: http://dev.mysql.com/doc/mysql/fr/query-cache.html pour plus de détails sur le benchmark qui a
permis d’obtenir ce résultat.

©Kamal AOUDA 2005 www.kamalaouda.com Page 164 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

6. Conclusion
k "? K ??/ ]a
# !! . :
 [ *(#"$ :
p N  ! . Z.  F…*(
Z*+?
‚
 ¿ h=.*( "? Ô—"B_ " ÓÓ ]  
 *+! C
 Ô

  ",  Œ˜",*4*+#"?
 
"H .
 @  Iqâ‚ #Y > 5!  UW . X ) !
± 
D  ï
$
! ô
Y   @     Y 
*(
Z*+?  / h=.*( "?  , f??] !  Z  Z …~) 5*4*+!   
$ ! N  _!&
4   Z+ 4",


Z ƒ'I
`
 *1 !l©,]
#¡¡"? > .¡ *(#"$ ¡
D l
.BŸ# ;#
A
"? ?  .S
 D #< q=.5 .
G
 *1
  ",  ìî U5 [ Ð"H .
5 @ 
5  "  ! … #
"H .*+? …V  #
"H .*+! …9
 N  _!&9  ", "?!  4 9 
.
Z.*4*(  + N 

  ",  I f("? h . *1
  ",  ; 
]?; # @  a    ?   >=.*( "?/!5! ‚# Z ;9[
.Z[ ?=# ) 
f   
  , .  ;
) ) . ;~5 ##< ;  1)) <#/  ;  ? +N  =>=. # ,ƒŽIkKN # 4  ͟.9  ;  ? 4
 >=.)*( "?c
 ] ? Êd .:",   # a",*4*+c …  ? FN  =>=. # a A!…",*1*+q

# Z 
Z+ .
"$

 @  +4
 <# *1 
? .I

fO   @  ì"? > .M *(."!$ Q=.


?!ì 5 F Ð*+   
# Ð
.  @   LÚ N  , ) &
?
$ .) [ []  
[
c .BŸ# Ê#
 p N BŸ), .‡:*(
 <# . . # ] …=) Ê K9
*+  
#îY N *+   .  VY #U",  ??"?îV
*(  Icâ‚V# , 5 &…
",! @  ! ”&?] > 59F >! .c .?
 F.Z

 ?   @ 
?
$ .. K N 

  @  


M
.BŸ# a#
 Ik   *1*+?  Q  ? Q! #M",? ) 
?  M
). F",?]
)  
 > #) 
!  4",*4*+/ ;=.*(  & Z H  1;"$!Z*+! ;",#/ ; ]  
 *+!
N 
1
. 5 h_
 ;
  \ =>=# #? 5(*(
<  \N =>=. . -  (~”O0J& O0O‚&JK0JKƒŽI

8‡R  .¡N "?",*1


Z *+! +!.S"!#
¡R 
! +l*( ‹P*(‡02
27P
(=."   .
 N "?"?< D9L"?P
"
*+! ; #
"     /  S
#
" ! S#*( @   ¡ ; Z Z ,  DC 
",*1*1
! . Xj“? .) )I:â‚V ?? _ .Ú?± î .

 #U
î W Z U
$ÉH    #4-=.
Ü,(94  .Z ?-  "?I

Ì # ?!4-  .+N "?",*4


Z *+! s $! h s ›h›>’Ê’Ê’(I“ÉB*( 

I ",*^›×eœJ‚ 

 Z

â (   . @  1"?  ??,",! ) 


 .;9 N 
) "$
 ?!*+! ; #) *( 1
"
*+? 5 #
‚
 ͟.9r€
 , 5! A p !" .5T‹ Z  :# =) €
 [ 
^ N  *15 5 "?q*(
Z*+! p 
 >=.)*( "? \
( 1",! .€! .+(",*4*+#"?4   "H .
 @  I

©Kamal AOUDA 2005 www.kamalaouda.com Page 165 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

7. Revue de la littérature pertinente

Titre Type Référence Objet


Ce livre :
Building Scalable
• Met en évidence les problèmes communément
and High- Greg Barish, Addison
liés au développement d’applications Web
Performance Wesley, December 27,
performantes.
Java(TM) Web Livre 2001, ISBN: 0-201-
• Décrit les technologies J2EE du point de vue de
Applications Using 72956-3, pages 416
leur scalabilité et de leur performance.
J2EE(TM)
• Propose plusieurs techniques d’optimisation
spécifiques aux technologies J2EE.
Database Tuning: Dennis Shasha and Ce livre qui est dédié à l’optimisation des bases de
Principles, Philippe Bonnet, données contient un chapitre entièrement consacré
Experiments, and Morgan Kaufmann aux applications de commerce électronique. Il
Livre
Troubleshooting Publishers, ISBN: contient également une étude de cas basée sur une
Techniques 1558607536, pages 415 mission d’optimisation réelle réalisée par l’auteur
pour le compte de Wall Street.
Le chapitre 14 traite des problèmes de performance
Mark Matthews
liés :
Jim Cole
• Au Connector J.
Joseph D. Gradecki,
MySQL and Java • Aux options du serveur.
Wiley Publishing,
Developer’s Guide Livre • Au RAID
2003, ISBN 0-471-
• Aux tables et aux requêtes.
26923-9, pages 433
• Aux travaux batch.
• Au connection pooling.
• A la gestion des transactions.
Ce livre contient plusieurs exemples qui montrent
Bil Lewis, Daniel J.
Multithreaded comment implémenter les techniques de
Berg, Prentice Hall
Programming with programmation multi-tâches dans les applications
Livre PTR, December 01,
JAVA™ Technology web dynamiques et ce afin d’exploiter de façon
1999, ISBN: 0-13-
optimale les performances des machines sur
017007-0, pages 461
lesquelles elles sont exécutées.
MySQL™ and JSP™
James Turner, March
Web Applications: Ce livre contient un chapitre dédié à l’optimisation
27, 2002, 0-672-32309-
Data-Driven Livre des applications web bâties à l’aide des technologies
5, pages 400
Programming Using Java et Mysql et utilisant Tomcat comme conteneur.
Tomcat and MySQL
Steve Suehring, Wiley La partie 4 de l’ouvrage traite des sujets
Mysql Bible Livre Publishing, ISBN d’optimisation avancés comme les réplications et la
0764549324 gestion des DNS.
Peter Gulutzan, Il s’agit d’un recueil des meilleures pratiques en
Trudy Pelzer, Addison matière d’optimisation des commandes et des
SQL Performance
Livre Wesley, September 10, requêtes SQL. Le chapitre 13 propose plusieurs
Tuning
2002, ISBN : 0-201- solutions pour accroître les performances des
79169-2, pages 528 applications utilisant l’API JDBC.
Database
Administration: The Craig S. Mullins, Un très bon manuel sur le métier de DBA et les
Complete Guide to Addison Wesley, June meilleurs benchmarks en matière d’analyse, de
Livre
Practices and 14, 2002, ISBN: 0-201- design et d’implémentation des bases de données
Procedures 74129-6, pages 592 relationnelles.

Rakesh Agrawal Amit


Storage and
Somani Yirong Xu, 27th Cet article propose des solutions architecturales pour
Querying of E-
Article VLDB Conference, optimiser le stockage et la récupération des données
Commerce Data
IBM Almaden Research dans les applications de commerce électronique.
Center
Patrick Killelea, Fournit des outils pour mesurer la performance des
Web Performance
O’Reilly, October 1998, applications web, ainsi que des patterns pour
Tuning Livre
ISBN: 1-56592-379-0, l’améliorer.
pages 374

©Kamal AOUDA 2005 www.kamalaouda.com Page 166 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL


 .

Titre Type Référence Objet


Etude qui évalue l’impact des
http://www.keynote.co
Zona Research, Need for speed problèmes de performance sur le
Rapport m/downloads/Zona_N
2 profit d’un panel représentatif
eed_For_Speed.pdf
d’entreprises américaines.
Zona Research, Inc., The
http://www.webperf.n
Economic Impacts of
Rapport et/info/wp_downloads Version antérieure de la même étude.
Unacceptable Web-Site
peed.pdf,
Download Speeds
Ethan Henry, Brad Micklea,
Diapositives d’une présentation de
Bridging the Java™ 2, Platform
Diapositives JavaOne 2004 JavaOne sur les performances des
Enterprise Edition (J2EE™)
applications J2EE.
Technology Performance Gaps
Segue Software, Inc, http://productfinder.c
Décrit l’apport des logiciels Borland et
ACHIEVING HIGH momagazine.com/cxo
Segue dans le domaine de
PERFORMANCE J2EE Article cm/search/viewabstra
l’évaluation et du management des
APPLICATIONS, January 2003 ct/64559/index.jsp
performances.
http://itpapers.zdnet.c
Borland White Paper,
om/abstract.aspx?scn
Maximizing business value by Article Idem
ame=J2EE&docid=92
optimizing J2EE™ performance
523
http://www.borland.co
Borland, ACCELERATE YOUR
Article m/optimizeit/pdf/opt6_ Idem
PERFORMANCE
datasheet.pdf
Thomas Malvehill, Key Décrit les défis auxquels les
http://www.veritas.co
Challenges in developing and entreprises doivent faire face lorsqu’il
Article m/van/articles/3533.js
deploying J2EE applications, s’agit de développer des applications
p
July 28, 2003 J2EE performantes.
Borland presentation on http://www.pcuf.fi/syty Diapositives d’une présentation de
Performance management for Diapositives ke/kerhot/javasig/Perf Borland sur les performances des
the J2EE platform, Man_J2EE.pdf applications J2EE.
Rapport qui recense les problèmes
de performance rencontrés par la
Teresa Lanowitz, Tearing Down
Rapport Gartner, 2002 plupart des entreprises qui ont utilisé
the Wall
J2EE dans l’implémentation de leurs
applications.
http://www.java.no/we
b/moter/javazone03/p
Diapositives d’une présentation de
Jon Ha Building Quality into resentations/JonHarri
Borland sur la qualité logicielle en
developement., Borland Diapositives
son/JH_QualityDevel général et les performances en
softwares
particulier.
opment_JavaZone.pd
f
Jakob Nielson, The Need for http://www.useit.com/ Texte de référence sur l’utilisabilité
Article
speed alertbox/9703a.html des interfaces web.
http://www.avoka.com
Keynote Systems Inc, E- /resources/keynote/E- Un modèle pour la décomposition et
COMMERCE RESPONSE Article Commerce_Respons le calcul du temps de réponse sur les
TIME: A REFERENCE MODEL e_Time_CMG_2000_ sites de commerce électronique.
_Chris_.pdf
Addison Wesley,
Stacy Joines, Ruth Willenborg, Livre de référence sur l’analyse des
September 10, 2002,
Ken Hygh, Performance Livre performances des applications web
ISBN: 0-201-84454-0,
Analysis for Java™ Web Sites écrites en Java.
pages 464

©Kamal AOUDA 2005 www.kamalaouda.com Page 167 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL


 .
Titre Type Référence Objet
MERCURY
Décrit l’apport des logiciels de
Diagnosing J2EE performance INTERACTIVE,
MERCURY INTERACTIVE dans
problems throughout the Article www.mercuryinteracti
l’identification des impasses et des
application life cycle ve.com
goulots d’étranglement.
Livre de référence sur l’optimisation
du code Java toutes applications
1st
Jack Shirazi, Java Performance confondues. Il explique comment
Edition September
Tuning Livre évaluer les performances d’un
2000 , ISBN: 0-596-
programme et présente une série
00015-4
d’outils et de techniques pour les
améliorer.
Jason Hunter , William 2nd edition, O'Reilly,
Ouvrage complet sur la
Crawford, Java Servlet Livre ISBN: 0-596-00040-5
programmation des servlets.
Programming
Gail Anderson, Paul Anderson,
Enterprise JavaBeans Ouvrage dédié au design et à la
Prentice Hall PTR, 0-
Component Architecture: Livre programmation des Enterprise Java
13-035571-2
Designing and Coding Beans.
Enterprise Applications
Manning Livre très récent sur les bugs
Ali Syed and Jamiel Sheikh,
Livre Publications , Spring fréquemment rencontrés dans les
Java Doctor
2005, applications Java
Manning, ISBN
Benjamin G. Sullins and Mark B. Livre complet sur les Java
Livre 1930110561, October
Whipple , JMX in Action Management Extensions.
2002
Daniel Menasce, Rudolf Riedi,
L’article propose une méthodologie
Rodrigo Fonseca, Wagner http://portal.acm.org/c
pour analyser les comportements des
Meira Jr., Flavia Peligrinelli, Article itation.cfm?id=38426
robots sur les sites d’affaires
Analyzing Robot Behavior in E- 8.378838
électroniques.
Business Sites.
D. A. Menascé, V. Almeida, R.
Fonseca, and M. A. Mendes, "A http://portal.acm.org/c Article qui traite de la caractérisation
Methodology for Workload Article itation.cfm?id=33702 de la charge de travail sur les sites de
Characterization of E-commerce 4 commerce électronique.
Sites,''
Mehdi Khouja, Farouk Kamoun, http://clei2004.spc.org Article qui propose une
Experimenting With the TPC-W Article .pe/es/html/pdfs/149. implémentation Java du benchmark
E-commerce Benchmark pdf TPC-W
Version 1.7, Oct 11,
Transaction Processing
2001 Texte intégral de la spécification
Performance Council (TPC), Spécification
http://www.tpc.org/tpc TPC-W
TPC-W BENCHMARK
w/spec/tpcw_V1.8.pdf
Daniel A. Menascé, Virgilio A. F.
Un livre qui fait autorité dans le
Almeida, Scaling for E-
Prentice Hall, 2000, domaine de l’évaluation des
Business: Technologies, Livre
ISBN 0-13-086328-9, performances et de la scalabilité des
Models, Performance, and
applications d’affaires électroniques
Capacity Planning
In Proc. Sixth IEEE
Daniel A. Menascé, Vasudeva
Workshop on
Akula, Towards Workload Cet article propose une méthodologie
Workload
Characterization of Auction Article pour caractériser la charge de travail
Characterization
Sites des sites C2C
(WWC-6), Austin, TX,
Oct. 27, 2003.
Daniel A. Menascé, Vasudeva
http://csdl.computer.o
Akula, Improving the Cet article propose des techniques
rg/comp/proceedings/
Performance of Online Auction Article pour optimiser les performances des
qest/2004/2185/00/21
Sites through Closing Time sites C2C
850186abs.htm
Rescheduling, 27 - 30, 2004

©Kamal AOUDA 2005 www.kamalaouda.com Page 168 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL


 .
ôõ öf÷ ø ô?ùúdø ûüdý ü%÷ ø%þŠÿ§ø  ødö
Pierre Alain Muller, modélisation
Eyrolles, 15/03/2000, Livre complet sur la notation
objet avec UML , Rational Livre
ISBN : 2-212-09122-2 UML.
Software Europe, avril 1997
Craig Larman, An Introduction
3 edition (October 20, Livre complet sur la notation
To Object-Oriented Analysis
Livre 2004), Prentice Hall PTR, UML et le Rational Unified
And Design And The Rup
ISBN: 0131489062 Process.
OMG, UML Profile for
Schedulability, Performance, http://www.omg.org/docs/f
Spécification Texte intégral du profil RTP
and Time Specification ormal/03-09-01.pdf

Bruce Powel Douglass, Real Third Edition, Addison


Livre consacré à la modélisation
Time UML: Advances in The Wesley, February 20,
Livre des systèmes temps réel avec la
UML for Real-Time Systems 2004, ISBN: 0-321-16076-
notation UML
2, 752 pages
Doug Rosenberg , Kendall
Livre dédié à la modélisation des
Scott, Applying Use Case Addison Wesley, First
applications de commerce
Driven Object Modeling with Livre Edition June 14, 2001,
électroniques avec la notation
UML: An Annotated e- ISBN: 0-201-73039-1
UML
Commerce Example
Early Evaluation of Software
Performance based on the UML
Cet article donne des exemples
Performance Profile, Gordon
http://portal.acm.org/citatio sur l’utilisation du profil RTP pour
Ping Gu and Dorina C. Petriu, Article
n.cfm?id=961335 la modélisation d’un site de
Department of Systems and
commerce électronique
Computer Engineering, Carleton
University, Ottawa
Govind Seshadri, http://www.javaworld.com/
Understanding JavaServer Article javaworld/jw-12-1999/jw- Article sur l’architecture Model 2
Pages Model 2 architecture 12-ssj-jspmvc.html
William Crawford, Jonathan O'Reilly, September 2003, Livre de référence sur les
Livre
Kaplan, J2EE Design Patterns 0-596-00427-3 patterns J2EE
http://java.sun.com/bluepri Présente le pattern composite
Sun Microsystems, Core J2EE
Catalogue nts/corej2eepatterns/Patte view ainsi que ses implications
Pattern Catalog, composite view
rns/CompositeView.html sur les performances
Budi Kurniawan, Java for the
New Riders Publishing, Livre détaillé sur les
Web with Servlets, JSP, and
Livre April 12, 2002, 0-7357- fondamentaux de la plateforme
EJB, A Developer's Guide to
1195-X J2EE
J2EE Solutions
Harvey W. Gunther, WebSphere
Application Server, http://www.ibm.com/softw Astuces pour l’optimisation des
Development Best Practices for Rapport are/webservers/appserv/w performances du WebSphere
Performance and Scalability s_bestpractices.pdf Application Server

O'Reilly, First Edition June


Duane Wessels, Web Caching Livre consacré aux stratégies de
Livre 2001, ISBN: 1-56592-536-
cache sur le web
X
Michael Rabinovich and
Addison Wesley,
Oliver Spatscheck, Web
Livre December 21, 2001, 0- Idem
Caching and Replication
201-61570-3
New Riders Publishing, Ouvrage qui couvre plusieurs
Speed Up Your Site: Web Site
Livre January 17, 2003, ISBN 0- techniques pour l’optimisation
Optimization
7357-1324-3 des sites web

©Kamal AOUDA 2005 www.kamalaouda.com Page 169 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL


 .
ôõ öf÷ ø ô?ùúdø ûüdý ü%÷ ø%þŠÿ§ø  ødö
2nd
Ed Roman, Scott Ambler, Tyler
Edition,Wiley,
Jewell, Ed Roman, Tyler Jewell,
Livre ISBN: Livre de référence sur les EJB.
Floyd Marinescu, Mastering
0471417114,
Enterprise JavaBeans
pages 672
http://www.comm
introduction à RMI Article entcamarche.net/ Brève introduction sur RMI
rmi/rmiintro.php3
http://java.sun.co
m/blueprints/core Présente le pattern session façade
Core J2EE Patterns - Session
Catalogue j2eepatterns/Patt ainsi que ses implications sur les
Façade
erns/SessionFac performances
ade.html
Présente en 48 leçons les techniques
permettant d’améliorer la
performance du code Java exécuté
Dov Bulka, Addison
Java™ Performance and du côté du serveur. Ces leçons
Wesley, June 05,
Scalability Volume 1: Server- Livre couvrent :
2000, ISBN : 0-201-
Side Programming Techniques La gestion de la mémoire.
70429-3, pages 320
Le cashing.
La programmation multitâche
(multithreading).
Addison-Wesley
Steve Wilson, Jeff Kesselman,
Professional; 1st
Java(TM) Platform Excellent ouvrage sur l’optimisation
edition (May 31,
Performance:Strategies and Livre des performances des applications
2000), ISBN:
Tactics écrites en Java
0201709694,
pages 230
Jayson Falkner, Kevin Jones, Addison Wesley,
Servlets and JavaServer September 19, Livre de référence sur la
Pages™: The J2EE™ Livre 2003, ISBN: 0- programmation des servlets et des
Technology Web Tier 321-13649-7, JSP
pages 784

Jayson Falkner, Another Java http://www.onjav Cet article explique comment modifier
Servlet Filter Most Web a.com/pub/a/onja l’entête d’un paquet http pour
Applications Should Have, Article
va/2004/03/03/filt ordonner au navigateur de mettre les
Client-Side Cache Control ers.html données en cache

Ravi Kalidindi and Rohini Datla,


http://www.precis
Best Practices to improve Ensemble de conseils pour
Article ejava.com/javape
performance in EJB l’optimisation des EJB
rf/j2ee/EJB.htm
http://www.javaw
Nitin Nanda, Learn how to
orld.com/javaworl Article sur la performance des drivers
deploy, use, and benchmark Article
d/jw-07-2000/jw- JDBC
JDBC driver types 1, 2, 3, and 4
0707-jdbc.html
Comparatif des performances des
Eweek, Database benchmarking http://www.ewee
Article principaux gestionnaires de base de
k.com
données
http://christophej.
Gestion d'un pool de developpez.com/ Tutoriel qui explique comment gérer
connexions SGBD par Tomcat Tutoriel
tutoriel/j2ee/poolt les connection pools sous Tomcat
omcat/
Jeremy Zawodny, Derek O'Reilly, April
Livre de référence sur l’optimisation
J. Balling, High Performance Livre 2004, ISBN: 0-
de MySQL
MySQL, 596-00306-4

©Kamal AOUDA 2005 www.kamalaouda.com Page 170 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

8. Annexes

©Kamal AOUDA 2005 www.kamalaouda.com Page 171 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Annexe 1: Liste exhaustive des profils UML

UML profiles

A Profile for Integrating Function Blocks into the Unified Modeling Language
A UML Profile for Agent-Oriented Modeling
A UML Profile for Aspect Oriented Modeling
A UML Profile for External AOR Models
A UML Profile for Modeling Workflow and Business Processes
A UML Profile for Real-Time Constraints with the OCL
A UML profile to support requirements engineering with KAOS
Building a UML Profile for MultiTEL
From UML to BPEL
Mapping Object to Data Models with the UML
Modelling QoS: Towards a UML Profile
Raven MDA-Profile
RCR: A UML Profile for Reverse Engineering, Program Comprehension, and Reengineering
Representing XML Schema in UML -- An UML Profile for XML Schema
Requirements for UML Profiles
Requirements for UML Profiles Presentations to the ADTF
The UML Profile for Framework Architectures
Towards a UML Profile for Model-Based Assessment
Towards a UML Profile for Model-Based Risk Assessment
Towards a UML Profile for Service-oriented Architectures
Towards a UML Profile for Software Architecture Descriptions
UML Data Modeling Profile
UML Profile and Interchange Models for EAI
UML profile for archetypes and archetype patterns
UML Profile for CORBA
UML Profile for CORBA Components
UML Profile for EJB
UML Profile for Enterprise Distributed Object Computing
UML Profile for Framework Architectures
UML Profile for Modeling Quality of Service and Fault Tolerance Characteristics and Mechanisms
UML Profile for MOF
UML Profile for Schedulability, Performance, and Time Specification
UML Profile for SPEM (from Software Process Engineering Metamodel Specification)
UML Profile for the Deployment and Configuration Language
UML Profile for Web Modeling (from Building Web Applications with UML by JIM CONALLEN)
UML Testing Profile
UML Testing Profile RFP
UML Textual Notation RFP

©Kamal AOUDA 2005 www.kamalaouda.com Page 172 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Annexe 2: Stéréotypes et étiquettes du sous-profil performance238


 
   
! "
#
%$&(')

Stereotype Applies to (metaclasses)239 Tags Description

Action, ActionExecution, ActionState,


PArespTime, PApriority, PApopulation,
«PAclosedLoad» SubactivityState, Stimulus, Message, A closed workload
PAextDelay
Method, Operation, Reception

Collaboration, Collaboration A performance


«PAcontext»
InstanceSet, ActivityGraph analysis context

PAutilization, PAschdPolicy, PArate, An execution


Classifier, Node, ClassifierRole,
«PAhost» PActxtSwT, PAprioRange, engine that hosts
Instance, Partition
PApreemptible, PAthroughput the scenario

Action, ActionExecution, ActionState,


PArespTime [0..*,] PApriority,
«PAopenLoad» SubactivityState, Stimulus, Message, An open workload
PAoccurrence
Method, Operation, Reception

PAutilization, PAschdPolicy,
Classifier, Node, ClassifierRole, PAschdParam, PAcapacity,
«PAresource» A passive resource
Instance, Partition PAaxTime, PArespTime, PAwaitTime,
PAthroughput

Messasge, ActionState, Stimulus, PAdemand, PArespTime, PAprob,


«PAstep» A step in a scenario
SubactivityState PArep, PAdelay, PAextOp, PAinterval

* % + # & ) & , 


  .-/102)" 3 &4
Tag Type Multiplicity Description

PArespTime PAperfValue [0..*] Time required for completion of the scenario from the start of the scenario

PApriority Integer [0..1] Priority of workload

PApopulation Integer [0..1] The size of the workload (i.e., the number of system users)

PAextDelay PAperfValue [0..1] The delay between the completion of one response and the start of the next
for each member of the population of system users

* % + # & ) & , 


  .-/1065 ,!4

Tag Type Multiplicity Description

PAutilization Real [0..*] The mean number of concurrent users

PSschdPolicy Scheduling Enumeration [0..1] Policy by which host schedules workloads

PArate Real [0..1] Processing rate of the scenario execution

PActxtSwT PAperfValue [0..1] Context switch time

PAprioRange Integer range [0..1] Valid range for priorities of workloads

PApreemptable Boolean [0..1] Whether scheduled workloads may be preempted

PAthroughput Real [0..1] Number of workloads completed per unit time

238
Source Bruce Powel Douglass, Real Time UML: Advances in The UML for Real-Time Systems, Third Edition, Addison
Wesley, February 20, 2004, ISBN: 0-321-16076-2, 752 pages
239
Ces classes sont définies dans le sous-profil des ressources. Pour plus de détails, consulter la version officielle du
profil sur le site de l’Object Management Group

©Kamal AOUDA 2005 www.kamalaouda.com Page 173 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

* % + # & ) & , 


  .-/102 '3 &(4

Tag Type Multiplicity Description

PArespTime PAperfValue [0..*] Time required for completion of the scenario from the start of the
scenario

PApriority Integer [0..1] The priority of workload

PAoccurrence RTarrivalPattern [0..1] The arrival pattern of the workload

* % + # & ) & , 


  .-/10
 
)4

Tag Type Multiplicity Description

PAutilization Real [0..*] The mean number of concurrent users

PAschdPolicy Scheduling [0..1] Policy by which host schedules workloads


Enumeration

PAcapacity Integer [0..1] Number of workloads that can be handled simultaneously, i.e. the
maximum number of concurrent users of the system

PAaxTime PAperfValue [0..1] Resource access time, that is, the time required to acquire or release
the resource

PArespTime PAperfValue [0..1] Time required for the resource to complete its response

PAwaitTime PAperfValue [0..1] The time between when a resource access is requested and when it is
granted

PAthroughput Real [0..1] Number of workloads that can be completed per unit time

* % + # & ) & , 


  .-/102, 4

Tag Type Multiplicity Description

PAdemand PAperfValue [0..*] The total demand of the step on its processing resource

PArespTime PAperfValue [0..*] The total time to execute the step, including the time to access and release
any resources

PAprob Real [0..1] In stochastic models, the probability that this step will be executed (as
opposed to alternative steps)

PArep Integer [0..1] The number of times the step is repeated

PAdelay PAperfValue [0..*] Delay between step execution

PAextOp PAextOpValue [0..*] The set of operations of resources used in the execution of the step

PAinterval PAperfValue [0..*] The time interval between successive executions of a step when the step is
repeated within a scenario

©Kamal AOUDA 2005 www.kamalaouda.com Page 174 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Annexe 3: Tables de correspondance entre les types de données de


MySQL vs Java vs JDBC240

240
Source: Mark Matthew, Jim Cole, Joseph D. Gradecki, MySQL and Java Developer’s Guide, Wiley Publishing,ISBN 0-
471-26923-9

©Kamal AOUDA 2005 www.kamalaouda.com Page 175 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

©Kamal AOUDA 2005 www.kamalaouda.com Page 176 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Liste des figures

7 8 
:9;=<2& $>'? A@8 &
BC D&E

#2 E$>&'&8 $>'?2A
# 
%$&')CFG" &H! '
 ),)" IIJ(" ($'LK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9?M
7 8 
ON(;?P6  II) (''Q 'RFC" S T '? 
!'$>'&8& QVU & W' K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9,X
7 8 
VY;?P6  II) (''Q 'RFC" S T '? 
!'('?B

W & Q *  & [Z' \K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9,X
7 8 
>];^6 
!@OO@ S 'R  OI) $I$
)O" ),B
B ' + _K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?NN
7 8 
O`(;a2" &% ('R('?B
C" O@ !b"   $OV
 'O1" &I)5&
8O>B
&J& "%K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?NY
7 8 
OX(; * +  J&" '?C" &C5&II)
 &')O&' '>$&8& 'I@
! + O1$
#% 
[K K K K K K K K K K K K K K K K K K K K?N]
7 8 
Vc.; * +  J&(" '?C" &C5&C" & &&(''I$&8& 'O@
! +O($>
#% 
K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?N]
7 8 
Od(; * Q $O" O S 'O8 $' &! '' '),! 'R) $O &('? C" S &" )&% ('K K K K K K K K K K K K K K K K K K?NX
7 8 
Ve;?f=
&'" &! 'hg2/A'>=
#J"  iK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?Nd
7 8 
A9?M; &8
& $O$OI)" & S ' * gjk
%$>  &('? S   
1'h &@" &S &$
#%  $'?K K K K K?Ne
7 8 
A99;^2)" IJ O S  'IlR&8(<i
! J'j&'K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K KY19
7 8 
A9,N(; T '? 
&),! (''?B
B." C/=
! " 
" &>gP6lmK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K KYX
7 8 
A9?Y;?0
)5  ),B
Og&J&.lR&'&8 $('? * Q ' '=K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K KYd
7 8 
A9n];lR o" II) $V
#  $('? S  'hJ    
1
(" J&'? ." &I)& 8
! H9RK K K K K K K K K K K K K K K K K K K K K K K K K K K K K Kp] N
7 8 
A9,`(;lR o" II) $V
#  $('? S  'hJ    
1
(" J&'? ." &I)& 8
! IN.K K K K K K K K K K K K K K K K K K K K K K K K K K K K K Kp]Y
7 8 
A9,X(;lR o" V
" &! ''"nI ''If\/_^BqrK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K Kp]c
7 8 
A9?c; * '?J
'' $('? f\/_^ qDK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K Kp] d
7 8 
A9,d(;/&# 
!' B
&% )R+  ! ( 'R
'R  IS '? 
!$( &! '% '&') o
>K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?`]
7 8 
A9?e; T $O&), C" S ! " &% ('RO
 ) " >f\3E
" I(@  S 'O&" )&% 'RS %) $I$
)s``
7 8 
ONM;?P2&
W &! '   $VV
 'O @  ('h '),! 'C" &> & " " I." &O)" >f\3.K K K K K K K K?``
7 8 
ON9;&  
!'RB
&! )R&''"n
'R  II5 ( '8tK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?`X
7 8 
ONN(; * "  $>'? .@&I O$ &W$ o" IS ZlO32K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?`e
7 8 
ONY; * Q $V" I, 
  ) &" &'?" ("  $' C@&O I$> &W$> o(" IS Z6lI3uXM
7 8 
vN]; * Q $O" v S  'v) '?B
& ' :& ) :&Qw" $'? xm$> (" &! ('w S  'G &8
&$I$
ZlI3K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?X9
7 8 
ON`(;B
%),B
BI V
! "a\fu/tK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?XY
7 8 
ONX(;= 
% "n.
#
%$&') ("n+I% '&
_ZlI3Va\f\/.K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?X`
7 8 
ONc; * Q $V" IS &''  &% ('&,y  & Q> &8
&$I$I)&S ! " &% '\K K K K K K K K K K K K K K K K K K K K K K K K?XX
7 8 
ONd(; * Q $V" IS &''  &% ('&,y  & Q> &8
&$I$S &),! J  zK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?Xd
7 8 
ONe;?0
)5  ),B
ClR "9hK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?Xe
7 8 
VYM;?0
)5  ),B
ClR "pNOK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K KcN
7 8 
VY19;?0
)5  ),B
.$I" % ^ ('?B
" " 
J
&
)5  ),%
 7
'? ^6 '?B
(" " 
K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K KcY

©Kamal AOUDA 2005 www.kamalaouda.com Page 177 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

7 8 
{YN(;\|'
&% ('}'& $O + wx&8H~@w&
€& $O@" &8wG) $O &('? k!&  
W'} 
) $O   J ~t‚K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K Kc]
7 8 
VYY;|,% ('R '>&
_" C@ & I$>)&' $C '? 8
IFC" S @ny#_ƒ= %\ '2K K K K K K K K K Kcd
7 8 
VY]; T $O&), ." & &( " " I S ' @ny#ƒ\ %= ('R
" I@  Rqx@5
>06" )&% ('>=
#J

K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K Kce
7 8 
VY`(;au„" y .&
_" $&8&,')5
'&'>" &O8,! ' )&)5K K K K K K K K K K K K K K K K K K K K K K K K K K?d]
7 8 
VYX(;|,% ('RO)&)5I& O$ 'S '>=
#J"  7 "  
K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?d`
7 8 
VYc;/  "p!5
&$& '? 'O&
1'R
#J
 S &" )&! '\K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?dd
7 8 
VYd(;< &8
& $O$OI)" &I I^ ''),% '/  ("!K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?de
7 8 
VYe; 7 &),
! &! '
 
) S 'O  (" K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K KeM
7 8 
>]M;lR o" I('R) )5IalVT …T T †>/IK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K Ke`
7 8 
>]=9; &8
& $O$OI)" &I  ('h &‡&€K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K Ke`
7 8 
>] N(;lR o" V
" &! ''"nI ''S 'I)" ' + V$ )&(" OK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K Kec
7 8 
>]Y;/&# 
!' * '?!   7 &)&uK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K Ked
7 8 
>]];^ $V&
&(  'C" &I) (')& '&% '>B
! '8JR) ')& '&% '>B
! '8j\  
ˆK K K K K K K K K K K K K K K K K K K9?M19
7 8 
s] `(;I/
#
%$>&')zsB
! '8f ‰,(' Š
.) $V&
B‹F‹)(" " z S 'Œf ‰,(' Š
C+ h% " " 
$%5 I 'Q†tB ‚1 @,B
! '8  ‚%C" &I)" &OB
W '8OK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9?M`
7 8 
>] X(;^€
&! ' S 'O' J& J), 
J
),)" &8O S  'hJ),  
(?y#FIQ , &'??K K K K K K K K K K K K K K K K K K K9?Md
7 8 
>]c; T $O&), C" &.$!5 C
! '?%" ' ‚1
" I@  S 'I
#J" K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9,NN
7 8 
Œ] d(;^6 $O&
&! >Ž
#
%$>&')bt)&)5 '8Žv @ˆy   * gjuƒ2 $>Jv8'
&! ('m S '

+  >g‘6<€T 
)5&+ . '?J )&% ('€K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9?Yc
7 8 
>]e;<
# Vau&CK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9?Ye
7 8 
O`M;Z'
& &@" V
&K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9n]M
7 8 
O`9;/\5& $ $‹
&iK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9n]M
7 8 
A`N(;(^ $V&
&! \A
#
%$&(')b&))o.
),uF}'C'?!  E@&'VJ.&))oOJ &}'C '
@&'uK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9n]=9
7 8 
O`Y;?g<6j_^!†><j=^v@
! 8VK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9n] N
7 8 
O`];‘u&! J 0€/2T ’1&
#%" Rg&J&I
! J
“K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9n]Y
7 8 
O``(;‘u 
 ) " ’ &" " %g&J&I
! J
K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9n]Y
7 8 
O`X(;‘u&! J
 ) (" ’ &" " Bg&J&O
! J
“K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9n]]
7 8 
O`c;<u& &(@&C@')5$&
%‰n’”u  _<u&J >l( &•T ')K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9n]]
7 8 
O`d(;?0
)5  ),B
O >
#J 
lh\–36K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9,`Y
7 8 
O`e;lR o" IJ
%
 " " &8I O) ')
%
'?! &("  I&('>lh\–3K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9,`c

©Kamal AOUDA 2005 www.kamalaouda.com Page 178 sur 179


Optimisation des applications web dynamiques pour les besoins du commerce électronique :
cas particulier de Java et MySQL

Liste des tableaux


f&@" & s9;a2&
#! % '&
),  
w S &),% J  mv
# v  '?! (" " { {& Q
@" o ${

#
%$&(')I&  ), &('?1" &(" )&% 'I) $O$
)I(" ),B
' +O .j_N^xK K K K K K K K K K K K K K K K K K K K K K K K K K Kc
f&@" & .N(;3&V ('&)  CV% " &  
I
& u" I8
&('C
2" I  O S '? 
!$ &! ('>% '&') o

K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9?c
f&@" & OY(; au "  & .—'   * !^6 $O$
)IqG@f=
B&'&),% ('V/_
#
%$&(')AT 'Q b $& 'V
N]Og&'?J 
NMM`K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9?e
f&@" & R];a2"  &  V—'   * j&('‰ '8qG@f=
&('&),% 'O/
#
!$&')HT 'Q(K K K K K K K K K K K K K K K K K K K K K9?e
f&@" & >`(;j')5$&
%‰R 
" &I) ''Q 'R&QO&8S &)) "ˆJ &O) ''Q ('RFI`XC—\@_K K K?NM
f&@" & >X(;3>@(')5$&
%‰?),
! " .—_'  (b$& 'IN]Og&'?J 
NMM`tK K K K K K K K K K K K K K K K K K K K K K K?N9
f&@" & Ec; * Q $V" }G@(')5$&
%‰,A 
6" &x$
B} H@ i )&C S % " &% ';1&))oCFx" &G&8
 S &))( "p S 'R  II) $O$
)I(" ),B
' + ‚_K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?N]
f&@" & >d(;l o(" O &@" & .@
BI $V" % . 
" &O8 $('? &! ('R R  $V.
 '\K K K K K KYY
f&@" & Ie.;3 , C' 'Q5&,% JI.
   % " &('? glh˜kK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K KYc
f&@" & •9?M.;/&8  Of\/_^ q™K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K Kp] `
f&@" & •99;^ ' ! 'RO)&" &@ "  I>f\/=^ qsK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K Kp] X
f&@" & •9,N(;/ 
)'? &8I&))oFI)5&)'II&8>fu/_^ qmK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K Kp] d
f&@" & •9?Y;T $O" $'? &% ('hg&J&I V@')5$&
%‰tf\/=^ qŒK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?`9
f&@" & •9n];j ( '('I
#
%$&')O' '),! ' O$> o(" IS &# &
B6K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?`d
f&@" & •9,`(;/=
' &! 'R $I$>&
O V
% " CZ6lI3Vauf\/6K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?XN
f&@" &  9?X(; ^6 $O
 '  "&  & " "   "& &8 S &)) "š    
5? %; ’ ’#~6~6~RK  " &
!$)5&(' )K ) $’“K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K?dc
f&@" & •9?c;^ ')& '&% ('>B
! '8J) ')& ('&! '>B
W '8(j=  
[K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9?MM
f&@" & •9,d(;?f=
(  
&! '+ p '?" .$ $>. $O&), 
" >
#
%$&(')K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9?M19
f&@" & E9?e;<2 QO) ')& ('&% '>+  ? ('?=" •$$•
"  & O$>& V&V" O$> $V $O&), >
\" 

#
%$&(')K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9?MN
f&@" & >NM;^ $V&
&!  >
#
%$&(')>
W ') &" ) (" " ),! 'uK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K99n]
f&@" & zN_9;CT $O&),•z$%5 s& * " $'B ‚EE '
# * " $'?#0\B ‚E
}" ›
#
%$&')
 )" &P2),
‚nK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K99,`
f&@" & >NN(;T $O&), >@" ))& )5?’ B
#+ ?'I8('o
('1&S Q)?! ' K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K99?c
f&@" & >NY;‘ J&Q S  " &% ('RB
&'&),% ' * gj2K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9n]M
f&@" & >N];T $O&), >' J& QS  (" &! ('R
" I
#
%$&') K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K9n]=9

©Kamal AOUDA 2005 www.kamalaouda.com Page 179 sur 179

Vous aimerez peut-être aussi