大量Json Data传输导致网站挂起/冻结
来源:互联网 发布:2015年网络流行语 编辑:程序博客网 时间:2024/05/29 19:13
Bug
问题代码:不能传输约32万组Json数据:
var request = $.ajax({type: 'GET',url:'support/search/searchHelper.php',data:{action:"Connect", x x x xxxx1:$('#lastName').val(),xxxx2:$('#otherName').val(),xxxx3:yearArray,xxxx4:$('#month').val(),xxxx5:$('#day').val(), xxxx6:$('#xxx6').val(),xxxx7:$('#age').val(), xxxx8:$('#xxx').val(),xxxx9:$('#xxxx').val()},success: function(reply){ if(reply == "report_Connect_Error"){ report_Connect_Error("Failed in connect to Database");} else{ $('.load_image').css('display','none'); table = $('#resultTable').DataTable( { data: JSON.parse(reply), columns: [ { data: 'xxx1'}, { data: 'xxx2'}, { data: 'xxx3'}, { data: 'xxx4'}, { data: 'xxx5'}, { data: 'xxx6'}, { data: 'xxx7'}, { data: 'xxx8'}, { data: 'xxx9'}, { data: 'xxx10'}, ], rowCallback: function(row, data ){ if($.inArray(data.DT_RowId,selected_id) > -1 ){$(row).addClass('selected');} }, columnDefs: [ { "visible": false, "targets": 0} ]});
Solutions
对Ajax进行操作:
- 添加异步代码 async:true
:对我的这个没用
- 增加fastCGI:RequestTimeout
和 ActivityTimeout
RequestTimeout
:对我的这个没用
javascript
timeout: 3000000000
- 增加Data type, 便于解析?但对我的这个没用
datatype : "json",contentType: "application/json; charset=utf-8",
More info
FastCGI
It is a binary protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface (CGI); FastCGI’s main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle more web page requests at once.
From: Wiki
然后我继续往后面debug,发现问题出现在数据库上,貌似不能传送太大的数据量:
可以用 以下代码检测 LIMIT 5000
$query = "SELECT * FROM merged_datasets WHERE ".$conditions."LIMIT 5000";
以上都不是最佳解决方案,因为数据需要全部显示,不能设定Limitation.
考虑到周围使用同样服务器的情况,可能服务器处理不了那么多数据导致的。
未完待续》。。。。。。。。。。
0 0
- 大量Json Data传输导致网站挂起/冻结
- JDBC 导致服务器挂起
- JDBC 导致服务器挂起
- TTL传输中过期问题导致网站打不开
- 解决json参数中有参数是url地址导致json无法正确传输与解析
- Hibernate懒加载导致json数据对象传输异常的问题---(非常重要)
- Slickedit11.0.2导致系统挂起解决方法
- 应用程序死锁导致服务器挂起的介绍
- 由于archive挂起导致数据库挂死
- 调用libvlc_media_player_stop经常会导致程序挂起
- OGG重复记录导致复制进程挂起
- 调用Process.waitfor导致的进程挂起
- 调用libvlc_media_player_stop经常会导致程序挂起
- 调用Process.waitfor导致的进程挂起
- ftps传输encrypt data
- usb data 传输格式
- 异步请求时,JSON.stringify()导致data参数中加号(+)丢失
- php查询mysql大量数据占用大量内存导致内存不足
- Linux C编程实战——第六章 文件操作
- 百度地图定位
- Android数据存储总结
- 定位
- python学习——virtualenv
- 大量Json Data传输导致网站挂起/冻结
- Hdu 5719 Arrange
- mysql LIMIT 子句用法及原理
- Bzoj3531:[Sdoi2014]旅行:树链剖分+动态开点线段树
- 快速排序
- Hdu 5720 Wool
- Shuffle related problem.
- 百度地图
- IntentService的使用