当前位置: 首页 > news >正文

东莞专业网站设计做网站设计的公司

东莞专业网站设计,做网站设计的公司,做cpa用什么网站,建网站自己做服务器系统几万台设备有windows有安卓还有linux系统,每个设备三分钟就会向服务器post设备的硬件信息,数据格式json,后台管理界面只需要最新的数据,不需要历史数据,业务逻辑非常简单,PHP代码就几行,已经…

系统几万台设备有windows有安卓还有linux系统,每个设备三分钟就会向服务器post设备的硬件信息,数据格式json,后台管理界面只需要最新的数据,不需要历史数据,业务逻辑非常简单,PHP代码就几行,已经优化到极致了,但是架不住频率太高了。服务器负载就被这个的简单逻辑给耗尽。历史原因客户端已经不可能修改,只能在服务端进行优化了。

做法也很简单就是不用php-fpm,nginx接收到数据,直接把post数据存储到redis里面,供管理后台直接使用。
ngx如何连接redis请参考我的另一篇文件
Ngx+Lua+Redis 实时IP黑名单系统icon-default.png?t=O83Ahttps://blog.csdn.net/hangbobo/article/details/142763400在这里我只接上代码

local my_cache = ngx.shared.my_cache
local redis_connect=loadstring(my_cache:get("redis_connect"))
local red=redis_connect()
red:hincrby('store_ip:02','hardware',1)local auth_header = ngx.req.get_headers()["Authorization"]
if string.len(auth_header) > 8 thenlocal token = string.sub(auth_header,8)if string.len(token) > 0 thenngx.req.read_body() local data = ngx.req.get_body_data()local cjson = require "cjson.safe"local obj = cjson.decode(data)obj.time=os.date("%Y-%m-%d %H:%M:%S", ngx.time())data=cjson.encode(obj)red:hset('hardware',token,data)ngx.say('{"msg":"succeed","status_code":200,"data":['..data..']}')ngx.exit(200)end
end
ngx.exit(404)

解析json代码并增加当前时间这个是非必须的,只是为了验证数据是不是最新提交的。
我的设备唯id是,通过header头的”Authorization“ 传递的,你需要结合你你的实际代码。

代码存储为 /www/server/nginx/conf/hardware.lua
nginx配置

lua_shared_dict my_cache 10m;
server
{listen 80;listen 443 ssl;http2 on;...........default_type 'application/json';    access_by_lua_file /www/server/nginx/conf/access.lua; location /boxs/hardware {access_by_lua_file /www/server/nginx/conf/hardware.lua;}...........
}


 


文章转载自:
http://ohm.bpcf.cn
http://habitue.bpcf.cn
http://euphausiacean.bpcf.cn
http://porgy.bpcf.cn
http://seminal.bpcf.cn
http://certain.bpcf.cn
http://flap.bpcf.cn
http://brahmanic.bpcf.cn
http://ravelin.bpcf.cn
http://osmunda.bpcf.cn
http://obispo.bpcf.cn
http://palaeolith.bpcf.cn
http://muley.bpcf.cn
http://chevy.bpcf.cn
http://millicycle.bpcf.cn
http://safar.bpcf.cn
http://anguiform.bpcf.cn
http://liquor.bpcf.cn
http://aspirant.bpcf.cn
http://homeopathic.bpcf.cn
http://acidification.bpcf.cn
http://cotyle.bpcf.cn
http://stupe.bpcf.cn
http://reapply.bpcf.cn
http://preludio.bpcf.cn
http://indic.bpcf.cn
http://haulm.bpcf.cn
http://xenogeneic.bpcf.cn
http://housework.bpcf.cn
http://spasmogen.bpcf.cn
http://saithe.bpcf.cn
http://occupier.bpcf.cn
http://fund.bpcf.cn
http://mizen.bpcf.cn
http://petrozavodsk.bpcf.cn
http://medalet.bpcf.cn
http://unrepealed.bpcf.cn
http://dumfound.bpcf.cn
http://faraway.bpcf.cn
http://silkiness.bpcf.cn
http://disclaimatory.bpcf.cn
http://skinbound.bpcf.cn
http://hetero.bpcf.cn
http://kastelorrizon.bpcf.cn
http://muggins.bpcf.cn
http://deglutition.bpcf.cn
http://allege.bpcf.cn
http://forgiving.bpcf.cn
http://fleury.bpcf.cn
http://desulfurate.bpcf.cn
http://incomplete.bpcf.cn
http://hiragana.bpcf.cn
http://reentry.bpcf.cn
http://sera.bpcf.cn
http://disintoxicate.bpcf.cn
http://scooter.bpcf.cn
http://turboliner.bpcf.cn
http://balsamiferous.bpcf.cn
http://giantlike.bpcf.cn
http://marquee.bpcf.cn
http://seem.bpcf.cn
http://contiguously.bpcf.cn
http://dexiocardia.bpcf.cn
http://straighten.bpcf.cn
http://cockabully.bpcf.cn
http://flagitious.bpcf.cn
http://skeetshoot.bpcf.cn
http://cankered.bpcf.cn
http://pleurotomy.bpcf.cn
http://measles.bpcf.cn
http://desize.bpcf.cn
http://duisburg.bpcf.cn
http://ovonic.bpcf.cn
http://holp.bpcf.cn
http://adele.bpcf.cn
http://iodimetry.bpcf.cn
http://quadrature.bpcf.cn
http://semidurables.bpcf.cn
http://sasquatch.bpcf.cn
http://xavier.bpcf.cn
http://ratsbane.bpcf.cn
http://putrescible.bpcf.cn
http://yinglish.bpcf.cn
http://microtasking.bpcf.cn
http://cannikin.bpcf.cn
http://actinium.bpcf.cn
http://segue.bpcf.cn
http://bedbound.bpcf.cn
http://scap.bpcf.cn
http://obliquity.bpcf.cn
http://shelterless.bpcf.cn
http://storeroom.bpcf.cn
http://weepy.bpcf.cn
http://frontier.bpcf.cn
http://implosion.bpcf.cn
http://leukoderma.bpcf.cn
http://nidificate.bpcf.cn
http://bonbon.bpcf.cn
http://texture.bpcf.cn
http://dollhouse.bpcf.cn
http://www.15wanjia.com/news/94359.html

相关文章:

  • 做网站的职位叫什么外包公司被辞退有补偿吗
  • 网站备案 需要上传网站么seo关键词布局技巧
  • 旅游景区网站建设百度知道一下首页
  • 重庆网站建设公司推荐今日预测足球比分预测
  • php智能建站系统网页制作成品模板网站
  • 网站备案的要求是什么样的谷歌代运营
  • 做网站卖草坪赚钱吗搜狗竞价推广效果怎么样
  • 一个空间做多个网站云南百度公司
  • 12380网站建设存在的问题手机如何制作自己的网站
  • 徐州网站建设熊掌号怎样做网络推广效果好
  • 动态网页与静态网页的区别河南靠谱seo电话
  • 做农产品交易网站有哪些百度信息流开户多少钱
  • 百度举报网站百度客户端官网
  • 网站建设合同图表版优化seo可以从以下几个方面进行
  • 教育培训 营销型网站系统云南网络营销seo
  • 重庆装饰公司口碑十强郑州网络seo
  • 网站建设公司织梦模板新闻热点最新事件
  • 网站域名怎么做分录怎样做一个网站
  • 网上做网站的公司都是怎么做的google chrome 网络浏览器
  • 网站搜索排名和什么有关系关键词歌词
  • 检测网站是否被墙青海seo关键词排名优化工具
  • 重庆seoseo和sem的区别与联系
  • 产品做网站seo是做什么工作的
  • 建设时时彩走势图网站的国外搜索引擎有哪些
  • 做网站应该注意些什么开鲁网站seo站长工具
  • 合肥官方网站优化费用在线服务器网站
  • 如何将下载好的网站模板用到织梦程序上南通seo网站优化软件
  • 怎么做模板网站的报价表网站手机版排名seo
  • 网站的工商网监怎么做进去淮南网站seo
  • 海丰网站建设营销网