21 #include "my_global.h"
29 static const ulong fixed_mutex_instances= 500;
30 static const ulong fixed_rwlock_instances= 200;
31 static const ulong fixed_cond_instances= 50;
32 static const ulong fixed_file_instances= 200;
33 static const ulong fixed_socket_instances= 10;
34 static const ulong fixed_thread_instances= 50;
36 static const ulong mutex_per_connection= 3;
37 static const ulong rwlock_per_connection= 1;
38 static const ulong cond_per_connection= 2;
39 static const ulong file_per_connection= 0;
40 static const ulong socket_per_connection= 1;
41 static const ulong thread_per_connection= 1;
43 static const ulong mutex_per_handle= 0;
44 static const ulong rwlock_per_handle= 0;
45 static const ulong cond_per_handle= 0;
46 static const ulong file_per_handle= 0;
47 static const ulong socket_per_handle= 0;
48 static const ulong thread_per_handle= 0;
50 static const ulong mutex_per_share= 5;
51 static const ulong rwlock_per_share= 3;
52 static const ulong cond_per_share= 1;
53 static const ulong file_per_share= 3;
54 static const ulong socket_per_share= 0;
55 static const ulong thread_per_share= 0;
126 5, 100, 5, 100, 5, 100,
142 10, 1000, 10, 1000, 10, 1000,
158 10, 10000, 10, 10000, 10, 10000,
169 static inline ulong apply_load_factor(ulong raw_value,
float factor)
171 float value = ((float) raw_value) / factor;
172 return (ulong) ceil(value);
178 (param->
m_hints.m_table_definition_cache <= TABLE_DEF_CACHE_DEFAULT) &&
179 (param->
m_hints.m_table_open_cache <= TABLE_OPEN_CACHE_DEFAULT))
186 (param->
m_hints.m_table_definition_cache <= TABLE_DEF_CACHE_DEFAULT * 2) &&
187 (param->
m_hints.m_table_open_cache <= TABLE_OPEN_CACHE_DEFAULT * 2))
190 return & medium_data;
200 ulong con = p->
m_hints.m_max_connections;
201 ulong handle = p->
m_hints.m_table_open_cache;
202 ulong share = p->
m_hints.m_table_definition_cache;
277 count= fixed_mutex_instances
278 + con * mutex_per_connection
279 + handle * mutex_per_handle
280 + share * mutex_per_share;
287 count= fixed_rwlock_instances
288 + con * rwlock_per_connection
289 + handle * rwlock_per_handle
290 + share * rwlock_per_share;
298 count= fixed_cond_instances
299 + con * cond_per_connection
300 + handle * cond_per_handle
301 + share * cond_per_share;
308 count= fixed_file_instances
309 + con * file_per_connection
310 + handle * file_per_handle
311 + share * file_per_share;
313 count= max<ulong>(count,
file);
319 count= fixed_socket_instances
320 + con * socket_per_connection
321 + handle * socket_per_handle
322 + share * socket_per_share;
329 count= fixed_thread_instances
330 + con * thread_per_connection
331 + handle * thread_per_handle
332 + share * thread_per_share;
341 heuristic= estimate_hints(param);
342 apply_heuristic(param, heuristic);