안녕하세요 아파치와 php를 이용하여 게임서버를 만들고 있습니다~

스트레스 테스트를 위해 아래상황을 연출햇는데요...


php페이지를 apache를 이용해서 호출을해서 DB에 데이터를 저장하도록하였습니다... 

for문으로 5000개 정도로해서 데이터저장을 요청했습니다... 

데이터를 저장하는 php가 5000번이 불리는상황인데.. (스트레스테스트를 위해 일부러..) 

근데 DB에 많은 값이 비었습니다... 

10개 ~ 100개 이상의 데이터가 유실되는 경우도 발생합니다 (php 한번호출에 4개의 데이터를 저장) 

DB측에 이야기했더니 apache에서 먼저 유실된게 아닌지 의심해 보라고 하시더라구요 

그래서 

apache설정을 올려봅니다... 



phpinfo() 
___________________________________________________________________________ 
System Linux ubuntu 3.2.0-37-generic #58-Ubuntu SMP Thu Jan 24 15:28:10 UTC 2013 x86_64 
Build Date Jan 18 2013 23:33:58 
Server API CGI/FastCGI 
Virtual Directory Support disabled 
Configuration File (php.ini) Path /etc/php5/cgi 
Loaded Configuration File /etc/php5/cgi/php.ini 
Scan this dir for additional .ini files /etc/php5/cgi/conf.d 
Additional .ini files parsed /etc/php5/cgi/conf.d/pdo.ini, /etc/php5/cgi/conf.d/xdebug.ini 
PHP API 20090626 
PHP Extension 20090626 
Zend Extension 220090626 
Zend Extension Build API220090626,NTS 
PHP Extension Build API20090626,NTS 
Debug Build no 
Thread Safety disabled 
Zend Memory Manager enabled 
Zend Multibyte Support disabled 
IPv6 Support enabled 
Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip 
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, tls 
Registered Stream Filters zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk 
_______________________________________________________________________________ 



apache 설정 파일 (apache2.conf) 
________________________________________________________________________________ 
Timeout 300 
MaxKeepAliveRequests 1024 
KeepAliveTimeout 5 

<IfModule mpm_worker_module> 
    StartServers          8 
    MinSpareThreads      64 
    MaxSpareThreads      512 
    ThreadLimit          1024 
    ThreadsPerChild      64 
    MaxClients          1024 
    MaxRequestsPerChild  0 
</IfModule> 
________________________________________________________________________________ 



아파치 정보 -V 
________________________________________________________________________________ 
root@ubuntu:~# apachectl -V 
Server version: Apache/2.2.22 (Ubuntu) 
Server built:  Nov  8 2012 21:37:37 
Server's Module Magic Number: 20051115:30 
Server loaded:  APR 1.4.6, APR-Util 1.3.12 
Compiled using: APR 1.4.6, APR-Util 1.3.12 
Architecture:  64-bit 
Server MPM:    Worker 
  threaded:    yes (fixed thread count) 
    forked:    yes (variable process count) 
Server compiled with.... 
 -D APACHE_MPM_DIR="server/mpm/worker" 
 -D APR_HAS_SENDFILE 
 -D APR_HAS_MMAP 
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) 
 -D APR_USE_SYSVSEM_SERIALIZE 
 -D APR_USE_PTHREAD_SERIALIZE 
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT 
 -D APR_HAS_OTHER_CHILD 
 -D AP_HAVE_RELIABLE_PIPED_LOGS 
 -D DYNAMIC_MODULE_LIMIT=128 
 -D HTTPD_ROOT="/etc/apache2" 
 -D SUEXEC_BIN="/usr/lib/apache2/suexec" 
 -D DEFAULT_PIDLOG="/var/run/apache2.pid" 
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" 
 -D DEFAULT_ERRORLOG="logs/error_log" 
 -D AP_TYPES_CONFIG_FILE="mime.types" 
 -D SERVER_CONFIG_FILE="apache2.conf" 
_______________________________________________________________________________ 




설정에 문제가 있길 바랍니다 ㅠㅠ 

답이 안보이네요 ㅠㅠ흑흑 

많은 답변 부탁드립니다 ㅠㅠ 감사합니다. 


_________________________________________________________________________________________ 
이런 글을 올렸었는데 

좀더 추적을 해보니 php가 요청될 때마다 로그를 찍도록 했더니 만약 3000번 호출했을때 로그가 1000개 정도 찍히고 
DB에는 그 1000개가 저장되더라구요.. 
확실히 DB문제는 아닌 것 같습니다. 

저 php 호출 루틴이 문제 인것 같은데... 

아래와 같습니다.. 

for (var i = 0; i <= max; ++i ) 
{
str =account+i; 
sendsize += str.length; 

request = new XMLHttpRequest(); 
request.onreadystatechange = on_End( max, "End"); 
request.ope("GET", "http://localhost/stress.php?account="+str, true); 
request.send(null); 

이런 루틴으로 호출하게 하였구요 max가 3000이면 3000번 호출합니다! 


그리고 저  호출이 완료되어 메세지를 받았을때 on_End함수는 아래와 같습니다. 
function on_End(counter, successMsg) 
endcount++; 

if ( counter <= endcount ) 
endtime = +new Date; 
var elapsedtime = (endtime -starttime)/1000; 

confirm(elapsedtime.toFixed(10)+"(초)"+"\n" + sendsize + "byte"+ " " + successMsg+" 완료 "+ endcount); 


이렇게 호출하고 있는데요 
on_End에서 confirm이 분명 3000개 완료되었다고 딱 뜨는데.. 
실제 호출한 php페이지는 1000개 이고... 

XMLHttpRequest의 호출이 묻힐 수도 있는건가요??