Bonjour,

J'ai codé un petit benchmark pour serveur php/mysql ne trouvant rien qui me convienne sur internet.

Cela test les accès mysql, quelques calculs, et les accès disque.

Si vous pouviez l'essayer sur vos serveurs respectifs et me copier/coller vos résultats ça serait top

Ma config serveur:
ASUS P5QL-pro
Intel Q8200
2Go mémoire


Ubuntu 9.10 en virtualbox sous windows 7

MOTEUR MYSQL MEMORY
MYSQL ecriture 77 97
MYSQL recherche varchar 39 77
MYSQL recherche int 32 234
MOTEUR MYSQL MYISAM
MYSQL ecriture 86 86
MYSQL recherche varchar 39 77
MYSQL recherche int 95 79
CALCUL
INCREMENTATION++ 25 108
MATHEMATIQUE 50 96
DISQUE
DISQUE Ecriture 37 41
DISQUE Lecture 64 94
DISQUE Ecriture Gros fichier 110 55
DISQUE Lecture Gros fichier 62 97
TEMPS 716s
SCORE 1140

Et vous ça donne quoi ?

A mettre dans un fichier index.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
 
 
<?
date_default_timezone_set("Europe/Paris");
ini_set('max_execution_time', 0);
$t_start = mktime();
 
 
//********************************************************************
//*** LAMP BENCH 2010 par myz-rix ************************************
//********************************************************************
 
 
//********************************************************************
//********************************************************************
//********************* CONFIGURATION MYSQL **************************
//********************************************************************
//********************************************************************
 
$mysql_host ="localhost";
$mysql_user ="root";
$mysql_pass ="";
$mysql_base = "bench";
 
//********************************************************************
//********************************************************************
//********************************************************************
//********************************************************************
//********************************************************************
 
 
 
 
 
 
 
 
 
$hard = 3; // niveau de difficulté
$t_total = 0;
 
$MYSQL_MOTEUR_ARRAY = array("MEMORY","MYISAM");
mysql_connect($mysql_host,$mysql_user,$mysql_pass) or die(mysql_error());
mysql_query("SET global max_heap_table_size=128*1024*1024") or die(mysql_error());
mysql_query("SET global tmp_table_size=128*1024*1024") or die(mysql_error());
 
foreach($MYSQL_MOTEUR_ARRAY as $MYSQL_MOTEUR)
{//96585
//****************************************************************
//*** ECRITURE *** 
//****************************************************************
$mysql_ecriture_i = 0;
${'t_mysql_ecriture_'.$MYSQL_MOTEUR.'_i'} = mktime();
 
mysql_query("DROP DATABASE `$mysql_base`");
mysql_query("CREATE DATABASE `$mysql_base`") or die(mysql_error());
mysql_query("CREATE TABLE `$mysql_base`.`table` (
`i` INT( 10 ) UNSIGNED NOT NULL ,
`v` VARCHAR( 255 ) NOT NULL ,
`d` DOUBLE NOT NULL
) ENGINE = '".$MYSQL_MOTEUR."' ") or die(mysql_error());
 
for($i = 1000000000; $i < (10000000000*$hard);$i = $i + 100000)
 {
 mysql_query("INSERT INTO `$mysql_base`.`table` (i,v,d) VALUES ('$i','".md5($i)."','".($i/100000)."')") or die(mysql_error());
 $mysql_ecriture_i++;
 }
 
${'t_mysql_ecriture_'.$MYSQL_MOTEUR} = mktime()- ${'t_mysql_ecriture_'.$MYSQL_MOTEUR.'_i'};
${'t_mysql_ecriture_'.$MYSQL_MOTEUR.'_us'} = ($mysql_ecriture_i / ${'t_mysql_ecriture_'.$MYSQL_MOTEUR})/39;
$t_total = $t_total + ${'t_mysql_ecriture_'.$MYSQL_MOTEUR};
$total_us = $total_us + ${'t_mysql_ecriture_'.$MYSQL_MOTEUR.'_us'};
 
//****************************************************************
//*** RECHERCHE VARCHAR *** 
//****************************************************************
$recherche_i = $hard*50000;
${'t_mysql_recherche_'.$MYSQL_MOTEUR.'_i'} = mktime();
for($i = 0; $i < ($recherche_i);$i++)
 {
 $recherche_1978_req = mysql_query("SELECT * FROM `$mysql_base`.`table` WHERE v LIKE '%1978%' ORDER BY v,d,i DESC") or die(mysql_error());
 //$recherche_1978_data = mysql_fetch_array($recherche_1978_req);
 //print '<br>'.$champ.':'.mysql_num_rows($recherche_1978_req).' - '.$recherche_1978_data[v];
 }
${'t_mysql_recherche_'.$MYSQL_MOTEUR} = mktime()- ${'t_mysql_recherche_'.$MYSQL_MOTEUR.'_i'};
${'t_mysql_recherche_'.$MYSQL_MOTEUR.'_us'} = ($recherche_i / ${'t_mysql_recherche_'.$MYSQL_MOTEUR})/50;
$t_total = $t_total + ${'t_mysql_recherche_'.$MYSQL_MOTEUR};
$total_us = $total_us + ${'t_mysql_recherche_'.$MYSQL_MOTEUR.'_us'};
 
//****************************************************************
//*** RECHERCHE INT *** 
//****************************************************************
$recherche_int_i = $hard*10;
${'t_mysql_recherche_int_'.$MYSQL_MOTEUR.'_i'} = mktime();
for($i = 0; $i < ($recherche_int_i);$i++)
 {
 mysql_query("SELECT * FROM `$mysql_base`.`table` WHERE i > 1 ORDER BY i DESC") or die(mysql_error());
 //print '<br>'.$champ.':'.mysql_num_rows($recherche_1978_req);
 }
${'t_mysql_recherche_int_'.$MYSQL_MOTEUR} = mktime()- ${'t_mysql_recherche_int_'.$MYSQL_MOTEUR.'_i'};
${'t_mysql_recherche_int_'.$MYSQL_MOTEUR.'_us'} = ($recherche_int_i / ${'t_mysql_recherche_int_'.$MYSQL_MOTEUR})*250;
$t_total = $t_total + ${'t_mysql_recherche_int_'.$MYSQL_MOTEUR};
$total_us = $total_us + ${'t_mysql_recherche_int_'.$MYSQL_MOTEUR.'_us'};
}//96585
 
 
 
//****************************************************************
//*** INCREMENTATION *** 
//****************************************************************
$incrementation_i = 100000000*$hard;
$t_incrementation_i = mktime();
for($i = 0; $i < ($incrementation_i);$i++)
 {
 // on patiente
 }
$t_incrementation = mktime() - $t_incrementation_i;
$incrementation_us = ($incrementation_i / $t_incrementation)/111111;
$t_total = $t_total + $t_incrementation;
$total_us = $total_us + $incrementation_us;
 
//****************************************************************
//*** MATHEMATIQUE *** 
//****************************************************************
$t_mathematique_i = mktime();
$mathematique_i = 10000000*$hard;
for($i = 0; $i < ($mathematique_i);$i++)
 {
 // racine carré
 sqrt($i);
 // Sinus
 sin($i);
 // decimal binaire hexa
 decbin($i);
 dechex($i);
 }
$t_mathematique = mktime() - $t_mathematique_i;
$mathematique_us = ($mathematique_i / $t_mathematique)/6250;
$t_total = $t_total + $t_mathematique; 
$total_us = $total_us + $mathematique_us;
 
//****************************************************************
//*** ECRITURE DISQUE *** 
//****************************************************************
$t_disque_w_i = mktime();
$disque_w_i = 100000*$hard;
for($i = 0; $i < ($disque_w_i);$i++)
 {
 $fichier = fopen("./test.csv",'w+');
 fputs($fichier,"\r\n"."a4bcaee7d57e19735590b480feaebddb");
 fclose($fichier);
 }
$t_disque_w = mktime() - $t_disque_w_i;
$disque_w_us = ($disque_w_i / $t_disque_w)/200;
$t_total = $t_total + $t_disque_w;
$total_us = $total_us + $disque_w_us;
 
//****************************************************************
//*** DISQUE LECTURE*** 
//****************************************************************
$t_disque_r_i = mktime();
$disque_r_i = 100000*10*$hard;
for($i = 0; $i < ($disque_r_i);$i++)
 {
 $fichier = fopen("./test.csv",'r');
 //fputs($fichier,"\r\n"."a4bcaee7d57e19735590b480feaebddb");
 fclose($fichier);
 }
$t_disque_r = mktime() - $t_disque_r_i;
$disque_r_us = ($disque_r_i / $t_disque_r)/500;
$t_total = $t_total + $t_disque_r;
$total_us = $total_us + $disque_r_us;
 
 
//****************************************************************
//*** ECRITURE DISQUE  GROS FICHIER*** 
//****************************************************************
$boucle_i = 10;
$t_disque_gw_i = mktime();
$disque_gw_i = $boucle_i*$hard;
for($x = 0; $x < ($disque_gw_i);$x++)
{
@unlink("./test_g.csv");
$fichier = fopen("./test_g.csv",'w+');
for($i = 0; $i < (300000);$i++)
 {
 fputs($fichier,"\r\n"."a4bcaee7d57e19735590b480feaebddb");
 }
fclose($fichier);
}
$t_disque_gw = mktime() - $t_disque_gw_i;
$disque_gw_us = ($disque_gw_i/$t_disque_gw)*200;
$t_total = $t_total + $t_disque_gw;
$total_us = $total_us + $disque_gw_us;
 
//****************************************************************
//*** DISQUE LECTURE GROS FICHIER*** 
//****************************************************************
$t_disque_gr_i = mktime();
$disque_gr_i = $boucle_i*100000*$hard;
for($i = 0; $i < ($disque_gr_i);$i++)
 {
 $fichier = fopen("./test_g.csv",'r');
 //fputs($fichier,"\r\n"."a4bcaee7d57e19735590b480feaebddb");
 fclose($fichier);
 }
$t_disque_gr = mktime() - $t_disque_gr_i;
$disque_gr_us = ($disque_gr_i / $t_disque_gr)/500;
$t_total = $t_total + $t_disque_gr;
$total_us = $total_us + $disque_gr_us;
 
 
 
//*********************
mysql_query("DROP DATABASE `$mysql_base`");
unlink("./test_g.csv");
unlink("./test.csv");
//*********************
$color = "00aa00";
print '<center>';
print '<table width=400 bgcolor="eeeeee">';
foreach($MYSQL_MOTEUR_ARRAY as $MYSQL_MOTEUR)
{
print '<tr><td colspan=20 bgcolor="888888"><font color="ffffff"><center>MOTEUR MYSQL '.$MYSQL_MOTEUR.'</td></tr>';
print '<tr><td>MYSQL ecriture</td><td align="right">'.${'t_mysql_ecriture_'.$MYSQL_MOTEUR}.'s</td><td align="right"><font color="'.$color.'">'.round(${'t_mysql_ecriture_'.$MYSQL_MOTEUR.'_us'},0).'</td></Tr>';
print '<tr><td>MYSQL recherche varchar</td><td align="right">'.${'t_mysql_recherche_'.$MYSQL_MOTEUR}.'s</td><td align="right"><font color="'.$color.'">'.round(${'t_mysql_recherche_'.$MYSQL_MOTEUR.'_us'},0).'</td></Tr>';
print '<tr><td>MYSQL recherche int</td><td align="right">'.${'t_mysql_recherche_int_'.$MYSQL_MOTEUR}.'s</td><td align="right"><font color="'.$color.'">'.round(${'t_mysql_recherche_int_'.$MYSQL_MOTEUR.'_us'},0).'</td></Tr>';
}
 
print '<tr><td colspan=20 bgcolor="888888"><font color="ffffff"><center>CALCUL</td></tr>';
print '<tr><td>INCREMENTATION++</td><td align="right">'.$t_incrementation.'s</td><td align="right"><font color="'.$color.'">'.round($incrementation_us,0).'</td></Tr>';
print '<tr><td>MATHEMATIQUE</td><td align="right">'.$t_mathematique.'s</td><td align="right"><font color="'.$color.'">'.round($mathematique_us,0).'</td></Tr>';
 
print '<tr><td colspan=20 bgcolor="888888"><font color="ffffff"><center>DISQUE</td></tr>';
print '<tr><td>DISQUE Ecriture</td><td align="right">'.$t_disque_w.'s</td><td align="right"><font color="'.$color.'">'.round($disque_w_us,0).'</td></Tr>';
print '<tr><td>DISQUE Lecture</td><td align="right">'.$t_disque_r.'s</td><td align="right"><font color="'.$color.'">'.round($disque_r_us,0).'</td></Tr>';
print '<tr><td>DISQUE Ecriture Gros fichier</td><td align="right">'.$t_disque_gw.'s</td><td align="right"><font color="'.$color.'">'.round($disque_gw_us,0).'</td></Tr>';
print '<tr><td>DISQUE Lecture Gros fichier</td><td align="right">'.$t_disque_gr.'s</td><td align="right"><font color="'.$color.'">'.round($disque_gr_us,0).'</td></Tr>';
 
print '<tr><td colspan=20 align="right"><center><b>TEMPS '.($t_total).'s</td></tr>';
print '<tr><td colspan=20 align="right"><center><font color="'.$color.'" size=8><b>SCORE '.round($total_us,0).'</td></tr>';
print '</table>';
 
?>