作者 | 绘你一世倾城
来源 | https://juejin.im/post/5d84e21f6fb9a06ac8248149
每到节假日期间,一二线城市返乡、外出游玩的人们几乎都面临着一个问题:
抢火车票!
抢火车票!
抢火车票!
12306 抢票,极限并发带来的思考
<section style="padding: 0.5em;max-width: 100%;line-height: 18px;font-size: 14px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);margin-left: 8px;margin-right: 8px;box-sizing: border-box !important;overflow-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;">https:<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//github.com/GuoZhaoran/spikeSystem</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></section>
大型高并发系统架构
负载均衡简介
-
轮询
-
加权轮询
-
IP Hash 轮询
Nginx 加权轮询的演示
<section style="padding: 0.5em;max-width: 100%;line-height: 18px;font-size: 14px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);margin-left: 8px;margin-right: 8px;box-sizing: border-box !important;overflow-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(91, 218, 237);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">#配置负载均衡</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> upstream load_rule {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> server <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">127.0.0.1</span>:<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">3001</span> weight=<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">1</span>;<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> server <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">127.0.0.1</span>:<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">3002</span> weight=<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">2</span>;<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> server <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">127.0.0.1</span>:<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">3003</span> weight=<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">3</span>;<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> server <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">127.0.0.1</span>:<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">3004</span> weight=<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">4</span>;<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> }<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> ...<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> server {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> listen <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">80</span>;<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> server_name load_balance.com www.load_balance.com;<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> location / {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> proxy_pass http:<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//load_rule;</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> }<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />}<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></section>
<section style="padding: 0.5em;max-width: 100%;line-height: 18px;font-size: 14px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);margin-left: 8px;margin-right: 8px;box-sizing: border-box !important;overflow-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">package</span> main<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">import</span> (<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"net/http"</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"os"</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"strings"</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;">func</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);">main</span><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(255, 152, 35);">()</span></span> {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> http.HandleFunc(<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"/buy/ticket"</span>, handleReq)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> http.ListenAndServe(<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">":3001"</span>, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">nil</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />}<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//处理请求函数,根据请求将响应结果信息写入日志</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;">func</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);">handleReq</span><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(255, 152, 35);">(w http.ResponseWriter, r *http.Request)</span></span> {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> failedMsg := <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"handle in port:"</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> writeLog(failedMsg, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"./stat.log"</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />}<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//写入日志</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;">func</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);">writeLog</span><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(255, 152, 35);">(msg <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">string</span>, logPath <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">string</span>)</span></span> {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> fd, _ := os.OpenFile(logPath, os.O_RDWR|os.O_CREATE|os.O_APPEND, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">0644</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">defer</span> fd.Close()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> content := strings.Join([]<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">string</span>{msg, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"rn"</span>}, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"3001"</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> buf := []<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">byte</span>(content)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> fd.Write(buf)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />}<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></section>
<section style="padding: 0.5em;max-width: 100%;line-height: 18px;font-size: 14px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);margin-left: 8px;margin-right: 8px;box-sizing: border-box !important;overflow-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">ab</span> -n <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">1000</span> -c <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">100</span> http://www.load_balance.com/buy/ticket<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></section>
<section style="padding: 0.5em;max-width: 100%;line-height: 18px;font-size: 14px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);margin-left: 8px;margin-right: 8px;box-sizing: border-box !important;overflow-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">https:</span>/<span class="" style="max-width: 100%;font-size: inherit;color: inherit;line-height: inherit;box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">/www.kancloud.cn/digest/understandingnginx/</span><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">202607</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></section>
秒杀抢购系统选型
下单减库存
-
在极限并发情况下,任何一个内存操作的细节都至关影响性能,尤其像创建订单这种逻辑,一般都需要存储到磁盘数据库的,对数据库的压力是可想而知的。
-
如果用户存在恶意下单的情况,只下单不支付这样库存就会变少,会少卖很多订单,虽然服务端可以限制 IP 和用户的购买订单数量,这也不算是一个好方法。
支付减库存
预扣库存
扣库存的艺术
代码演示
初始化工作
<section style="padding: 0.5em;max-width: 100%;line-height: 18px;font-size: 14px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);margin-left: 8px;margin-right: 8px;box-sizing: border-box !important;overflow-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;">...<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//localSpike包结构体定义</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">package</span> localSpike<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">type</span> LocalSpike <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">struct</span> {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> LocalInStock <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">int64</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> LocalSalesVolume <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">int64</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />}<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />...<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//remoteSpike对hash结构的定义和redis连接池</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">package</span> remoteSpike<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//远程订单存储健值</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">type</span> RemoteSpikeKeys <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">struct</span> {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> SpikeOrderHashKey <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">string</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//redis中秒杀订单hash结构key</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> TotalInventoryKey <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">string</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//hash结构中总订单库存key</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> QuantityOfOrderKey <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">string</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//hash结构中已有订单数量key</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />}<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//初始化redis连接池</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;">func</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);">NewPool</span><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(255, 152, 35);">()</span> *<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);">redis</span>.<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);">Pool</span></span> {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">return</span> &redis.Pool{<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> MaxIdle: <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">10000</span>,<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> MaxActive: <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">12000</span>, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">// max number of connections</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> Dial: <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;">func</span><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(255, 152, 35);">()</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(255, 152, 35);">(redis.Conn, error)</span></span> {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> c, err := redis.Dial(<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"tcp"</span>, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">":6379"</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">if</span> err != <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">nil</span> {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">panic</span>(err.Error())<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> }<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">return</span> c, err<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> },<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> }<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />}<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />...<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;">func</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);">init</span><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(255, 152, 35);">()</span></span> {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> localSpike = localSpike2.LocalSpike{<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> LocalInStock: <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">150</span>,<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> LocalSalesVolume: <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">0</span>,<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> }<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> remoteSpike = remoteSpike2.RemoteSpikeKeys{<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> SpikeOrderHashKey: <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"ticket_hash_key"</span>,<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> TotalInventoryKey: <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"ticket_total_nums"</span>,<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> QuantityOfOrderKey: <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"ticket_sold_nums"</span>,<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> }<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> redisPool = remoteSpike2.NewPool()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> done = <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">make</span>(<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">chan</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">int</span>, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">1</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> done <- <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">1</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />}<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></section>
本地扣库存和统一扣库存
<section style="padding: 0.5em;max-width: 100%;line-height: 18px;font-size: 14px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);margin-left: 8px;margin-right: 8px;box-sizing: border-box !important;overflow-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">package</span> localSpike<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//本地扣库存,返回bool值</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;">func</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(255, 152, 35);">(spike *LocalSpike)</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);">LocalDeductionStock</span><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(255, 152, 35);">()</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);">bool</span></span>{<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> spike.LocalSalesVolume = spike.LocalSalesVolume + <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">1</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">return</span> spike.LocalSalesVolume < spike.LocalInStock<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />}<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></section>
<section style="padding: 0.5em;max-width: 100%;line-height: 18px;font-size: 14px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);margin-left: 8px;margin-right: 8px;box-sizing: border-box !important;overflow-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">package</span> remoteSpike<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />......<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />const LuaScript = `<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">local</span> ticket_key = KEYS[<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">1</span>]<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">local</span> ticket_total_key = ARGV[<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">1</span>]<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">local</span> ticket_sold_key = ARGV[<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">2</span>]<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">local</span> ticket_total_nums = <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">tonumber</span>(redis.call(<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">'HGET'</span>, ticket_key, ticket_total_key))<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">local</span> ticket_sold_nums = <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">tonumber</span>(redis.call(<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">'HGET'</span>, ticket_key, ticket_sold_key))<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">-- 查看是否还有余票,增加订单数量,返回结果值</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">if</span>(ticket_total_nums >= ticket_sold_nums) <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">then</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">return</span> redis.call(<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">'HINCRBY'</span>, ticket_key, ticket_sold_key, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">1</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">end</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">return</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">0</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />`<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />//远端统一扣库存<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />func (RemoteSpikeKeys *RemoteSpikeKeys) RemoteDeductionStock(conn redis.Conn) bool {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> lua := redis.NewScript(<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">1</span>, LuaScript)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> result, err := redis.Int(lua.Do(conn, RemoteSpikeKeys.SpikeOrderHashKey, RemoteSpikeKeys.TotalInventoryKey, RemoteSpikeKeys.QuantityOfOrderKey))<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">if</span> err != <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">nil</span> {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">return</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">false</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> }<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">return</span> result != <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">0</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />}<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></section>
<section style="padding: 0.5em;max-width: 100%;line-height: 18px;font-size: 14px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);margin-left: 8px;margin-right: 8px;box-sizing: border-box !important;overflow-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">hmset</span> ticket_hash_key <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"ticket_total_nums"</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">10000</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"ticket_sold_nums"</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">0</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></section>
响应用户信息
<section style="padding: 0.5em;max-width: 100%;line-height: 18px;font-size: 14px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);margin-left: 8px;margin-right: 8px;box-sizing: border-box !important;overflow-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">package</span> main<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />...<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;">func</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);">main</span><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(255, 152, 35);">()</span></span> {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> http.HandleFunc(<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"/buy/ticket"</span>, handleReq)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> http.ListenAndServe(<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">":3005"</span>, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">nil</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />}<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></section>
<section style="padding: 0.5em;max-width: 100%;line-height: 18px;font-size: 14px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);margin-left: 8px;margin-right: 8px;box-sizing: border-box !important;overflow-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">package</span> main<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//处理请求函数,根据请求将响应结果信息写入日志</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;">func</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);">handleReq</span><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(255, 152, 35);">(w http.ResponseWriter, r *http.Request)</span></span> {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> redisConn := redisPool.Get()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> LogMsg := <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">""</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <-done<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//全局读写锁</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">if</span> localSpike.LocalDeductionStock() && remoteSpike.RemoteDeductionStock(redisConn) {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> util.RespJson(w, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">1</span>, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"抢票成功"</span>, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">nil</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> LogMsg = LogMsg + <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"result:1,localSales:"</span> + strconv.FormatInt(localSpike.LocalSalesVolume, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">10</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> } <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">else</span> {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> util.RespJson(w, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">-1</span>, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"已售罄"</span>, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">nil</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> LogMsg = LogMsg + <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"result:0,localSales:"</span> + strconv.FormatInt(localSpike.LocalSalesVolume, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">10</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> }<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> done <- <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">1</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(128, 128, 128);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">//将抢票状态写入到log中</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> writeLog(LogMsg, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"./stat.log"</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />}<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;">func</span> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);">writeLog</span><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(255, 152, 35);">(msg <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">string</span>, logPath <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">string</span>)</span></span> {<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> fd, _ := os.OpenFile(logPath, os.O_RDWR|os.O_CREATE|os.O_APPEND, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">0644</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">defer</span> fd.Close()<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> content := strings.Join([]<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">string</span>{msg, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">"rn"</span>}, <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">""</span>)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> buf := []<span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(248, 35, 117);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">byte</span>(content)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> fd.Write(buf)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />}<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></section>
单机服务压测
<section style="padding: 0.5em;max-width: 100%;line-height: 18px;font-size: 14px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);margin-left: 8px;margin-right: 8px;box-sizing: border-box !important;overflow-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(238, 220, 112);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">ab</span> -n <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">10000</span> -c <span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(174, 135, 250);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">100</span> http://127.0.0.1:3005/buy/ticket<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></section>
<section style="padding: 0.5em;max-width: 100%;line-height: 18px;font-size: 14px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);margin-left: 8px;margin-right: 8px;box-sizing: border-box !important;overflow-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;">This is ApacheBench, Version 2.3 <$revision: 1826891=""><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Licensed to The Apache Software Foundation, http://www.apache.org/<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Benchmarking 127.0.0.1 (be patient)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Completed 1000 requests<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Completed 2000 requests<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Completed 3000 requests<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Completed 4000 requests<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Completed 5000 requests<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Completed 6000 requests<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Completed 7000 requests<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Completed 8000 requests<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Completed 9000 requests<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Completed 10000 requests<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Finished 10000 requests<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Server Software:<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Server Hostname: 127.0.0.1<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Server Port: 3005<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Document Path: /buy/ticket<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Document Length: 29 bytes<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Concurrency Level: 100<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Time taken for tests: 2.339 seconds<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Complete requests: 10000<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Failed requests: 0<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Total transferred: 1370000 bytes<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />HTML transferred: 290000 bytes<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Requests per second: 4275.96 [#/sec] (mean)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Time per request: 23.387 [ms] (mean)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Time per request: 0.234 [ms] (mean, across all concurrent requests)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Transfer rate: 572.08 [Kbytes/sec] received<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Connection Times (ms)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /> min mean[+/-sd] median max<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Connect: 0 8 14.7 6 223<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Processing: 2 15 17.6 11 232<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Waiting: 1 11 13.5 8 225<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Total: 7 23 22.8 18 239<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />Percentage of the requests served within a certain time (ms)<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(91, 218, 237);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 50%</span><span class="" style="max-width: 100%;font-size: inherit;color: inherit;line-height: inherit;box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 18</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(91, 218, 237);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 66%</span><span class="" style="max-width: 100%;font-size: inherit;color: inherit;line-height: inherit;box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 24</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(91, 218, 237);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 75%</span><span class="" style="max-width: 100%;font-size: inherit;color: inherit;line-height: inherit;box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 26</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(91, 218, 237);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 80%</span><span class="" style="max-width: 100%;font-size: inherit;color: inherit;line-height: inherit;box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 28</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(91, 218, 237);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 90%</span><span class="" style="max-width: 100%;font-size: inherit;color: inherit;line-height: inherit;box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 33</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(91, 218, 237);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 95%</span><span class="" style="max-width: 100%;font-size: inherit;color: inherit;line-height: inherit;box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 39</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(91, 218, 237);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 98%</span><span class="" style="max-width: 100%;font-size: inherit;color: inherit;line-height: inherit;box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 45</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(91, 218, 237);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 99%</span><span class="" style="max-width: 100%;font-size: inherit;color: inherit;line-height: inherit;box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 54</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(91, 218, 237);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 100%</span><span class="" style="max-width: 100%;font-size: inherit;color: inherit;line-height: inherit;box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;"> 239 (longest request)</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></section>
<section style="padding: 0.5em;max-width: 100%;line-height: 18px;font-size: 14px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);margin-left: 8px;margin-right: 8px;box-sizing: border-box !important;overflow-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;">//stat.log<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />...<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">result:1,localSales:145</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">result:1,localSales:146</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">result:1,localSales:147</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">result:1,localSales:148</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">result:1,localSales:149</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">result:1,localSales:150</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">result:0,localSales:151</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">result:0,localSales:152</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">result:0,localSales:153</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">result:0,localSales:154</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /><span class="" style="max-width: 100%;font-size: inherit;line-height: inherit;color: rgb(165, 218, 45);box-sizing: border-box !important;overflow-wrap: inherit !important;word-break: inherit !important;">result:0,localSales:156</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" />...<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></section>
总结回顾
<section style="margin-right: 8px;margin-left: 8px;max-width: 100%;white-space: normal;color: rgb(0, 0, 0);font-family: -apple-system-font, system-ui, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 0.544px;text-align: center;widows: 1;line-height: 1.75em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;letter-spacing: 0.5px;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;font-size: 16px;letter-spacing: 0.544px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;letter-spacing: 0.5px;box-sizing: border-box !important;overflow-wrap: break-word !important;">—</span></strong>完<strong style="max-width: 100%;font-size: 16px;letter-spacing: 0.544px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;letter-spacing: 0.5px;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;font-size: 16px;letter-spacing: 0.544px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;letter-spacing: 0.5px;box-sizing: border-box !important;overflow-wrap: break-word !important;">—</span></strong></span></strong></span></strong></section><section style="max-width: 100%;white-space: normal;font-family: -apple-system-font, system-ui, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 0.544px;text-align: center;widows: 1;color: rgb(255, 97, 149);box-sizing: border-box !important;overflow-wrap: break-word !important;"><section powered-by="xiumi.us" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="margin-top: 15px;margin-bottom: 25px;max-width: 100%;opacity: 0.8;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="max-width: 100%;letter-spacing: 0.544px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section powered-by="xiumi.us" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="margin-top: 15px;margin-bottom: 25px;max-width: 100%;opacity: 0.8;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="margin-right: 8px;margin-bottom: 15px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;color: rgb(127, 127, 127);font-family: sans-serif;font-size: 12px;line-height: 25.5938px;letter-spacing: 3px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(0, 0, 0);box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;font-size: 16px;font-family: 微软雅黑;caret-color: red;box-sizing: border-box !important;overflow-wrap: break-word !important;">为您推荐</span></strong></span></section><p style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;color: rgb(127, 127, 127);font-family: sans-serif;font-size: 12px;line-height: 1.75em;letter-spacing: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;">猎户座α<span style="max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">:</span><span style="max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">AI玩转「吃鸡」游戏</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></p><p style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;color: rgb(127, 127, 127);font-family: sans-serif;font-size: 12px;line-height: 1.75em;letter-spacing: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;">网传饶毅举报多位学者论文造假?官方回应了<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></p><p style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;color: rgb(127, 127, 127);font-family: sans-serif;font-size: 12px;line-height: 1.75em;letter-spacing: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;">阿里如何抗住90秒100亿?看这篇你就明白了!<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></p><p style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;color: rgb(127, 127, 127);font-family: sans-serif;font-size: 12px;line-height: 1.75em;letter-spacing: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;">深度学习必懂的13种概率分布<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></p><p style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;color: rgb(127, 127, 127);font-family: sans-serif;font-size: 12px;line-height: 1.75em;letter-spacing: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;">担心美国政府限制,Github考虑在华设立子公司<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></p></section></section></section></section></section></section></section></section>
<section style="margin-right: 8px;margin-left: 8px;max-width: 100%;white-space: normal;color: rgb(0, 0, 0);font-family: -apple-system-font, system-ui, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 0.544px;text-align: center;widows: 1;line-height: 1.75em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;letter-spacing: 0.5px;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;font-size: 16px;letter-spacing: 0.544px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;letter-spacing: 0.5px;box-sizing: border-box !important;overflow-wrap: break-word !important;">—</span></strong>完<strong style="max-width: 100%;font-size: 16px;letter-spacing: 0.544px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;letter-spacing: 0.5px;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;font-size: 16px;letter-spacing: 0.544px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;letter-spacing: 0.5px;box-sizing: border-box !important;overflow-wrap: break-word !important;">—</span></strong></span></strong></span></strong></section><section style="max-width: 100%;white-space: normal;font-family: -apple-system-font, system-ui, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 0.544px;text-align: center;widows: 1;color: rgb(255, 97, 149);box-sizing: border-box !important;overflow-wrap: break-word !important;"><section powered-by="xiumi.us" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="margin-top: 15px;margin-bottom: 25px;max-width: 100%;opacity: 0.8;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="max-width: 100%;letter-spacing: 0.544px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section powered-by="xiumi.us" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="margin-top: 15px;margin-bottom: 25px;max-width: 100%;opacity: 0.8;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="margin-right: 8px;margin-bottom: 15px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;color: rgb(127, 127, 127);font-family: sans-serif;font-size: 12px;line-height: 25.5938px;letter-spacing: 3px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(0, 0, 0);box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;font-size: 16px;font-family: 微软雅黑;caret-color: red;box-sizing: border-box !important;overflow-wrap: break-word !important;">为您推荐</span></strong></span></section><p style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;color: rgb(127, 127, 127);font-family: sans-serif;font-size: 12px;line-height: 1.75em;letter-spacing: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;">猎户座α<span style="max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">:</span><span style="max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">AI玩转「吃鸡」游戏</span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></p><p style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;color: rgb(127, 127, 127);font-family: sans-serif;font-size: 12px;line-height: 1.75em;letter-spacing: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;">网传饶毅举报多位学者论文造假?官方回应了<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></p><p style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;color: rgb(127, 127, 127);font-family: sans-serif;font-size: 12px;line-height: 1.75em;letter-spacing: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;">阿里如何抗住90秒100亿?看这篇你就明白了!<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></p><p style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;color: rgb(127, 127, 127);font-family: sans-serif;font-size: 12px;line-height: 1.75em;letter-spacing: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;">深度学习必懂的13种概率分布<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></p><p style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;color: rgb(127, 127, 127);font-family: sans-serif;font-size: 12px;line-height: 1.75em;letter-spacing: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;">担心美国政府限制,Github考虑在华设立子公司<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;" /></p></section></section></section></section></section></section></section></section>
本篇文章来源于: 深度学习这件小事
本文为原创文章,版权归知行编程网所有,欢迎分享本文,转载请保留出处!
内容反馈