websocket資料過多分批渲染到頁面

2021-10-19 07:45:45 字數 700 閱讀 7151

業務需求:感測器採集到的振動資料需要全部記錄,當條件發生變化的時候需要及時反饋並記錄當下的資料並觸發機器關閉

實時資料與設定的上限資料與下限資料同時體現在echarts折線圖之中,當實時資料超過上線時觸發報警並關機。

由於資料量太大,一秒鐘至少一百條,因此實時渲染到echarts上會導致整個頁面卡死。

上面已經提到,資料太快,資料量太大導致頁面卡頓

資料來的時候,先攢起來,並不立即渲染到echarts上面,一秒鐘觸發一次渲染,讓積攢到的資料全部渲染到頁面上,頁面每次最多顯示一千條資料

let _this =

this

_this.$io.on(

'websocket_tool_process'

,function

(data)

_this.xaxis.time.

push

(res.collect_time)

_this.xaxis.data.

push

(res.vibration_x_rms)})

//定時給echarts送資料

"xaxis" ref=

"xchildecharts"

/>

_this.timer =

setinterval((

)=>

,1000

)

Linux下CLOSE WAIT過多分析與解決

檢視鏈結狀態 netstat ant awk tcp end 情景描述 系統產生大量 too many open files 原因分析 在伺服器與客戶端通訊過程中,因伺服器發生了socket未關導致的closed wait發生,致使監聽port開啟的控制代碼數到了1024個,且均處於close wa...

資料分批顯示

比如 資料來源是個array viewcontroller的這個方法返回資料條數 1是為了顯示 載入更多 的那個cell nsinteger tableview uitableview tableview numberofrowsinsection nsinteger section 處理 載入更多...

分批訓練資料

分批訓練資料用於資料量較多時。import torch import torch.utils.data as data batch size 5x torch.linspace 1,10,10 y torch.linspace 10,1,10 torch dataset data.tensordat...