php - will my data collide? -
i post data remote php file , there using post method saving data remote mysql database simple is.
but worry getting data every 30sec 1minute , sending server via http post android mobile i.e 'n' no of mobiles so, data collide? there chance of loosing data? ex: 100mobiles
currently using 000webhost.com free hosting, planning move paid one.
but need buffer incoming data , save avoid data loss? or continue same approach , have high speed server?
i dont have knowledge maximum @ speed server can process incoming data. if many data comes many mobiles @ same time? need manually buffer or server me.
if manual buffer please share code can understand better. (battery of android mobile have taken care , using gps , network provider)
<?php $longitude = $_post['lon']; $latitude= $_post['lat']; $imei= $_post['imei']; $speed = $_post['sp']; $date = $_post['date']; if($longitude != "" && $latitude != "") { $mysql_host = "xxx"; $mysql_database = "xxx"; $mysql_user = "xxx"; $mysql_password = "xxx"; $con=mysql_connect($mysql_host,$mysql_user,$mysql_password ) or die ("unable select db".mysql_error()); if($con) { mysql_select_db($mysql_database); //check if imei number exists $sql="select emp_name mob_reg imei='$imei'"; $result=mysql_query($sql); if((mysql_num_rows($result))== 0) { echo "invalid"; } else { $sql="insert details(imei,lon,lat,speed,date) values('$imei','$longitude','$latitude','$speed','$date');"; mysql_query($sql) or die("couldnt insert"); } } else{ echo 'invalid'; } } ?>
i don't think need worry buffering in code. code should deal each request efficiently possible.
your infrastructure should set according how traffic expect.
if service going busy, can think load-balancing (having more 1 web-server and/or database server handle incoming requests, depending on bottlenecks are)
Comments
Post a Comment