zoukankan      html  css  js  c++  java
  • 文章详情列表接口 小程序及 模拟器 条数 错误 浏览器正确 调大mysql 查询超时时间 同一接口,小程序环境的TTFB相比浏览器约大5倍。

    文章详情列表接口 小程序及模拟器 条数 错误 浏览器正确

    【Request Headers】
    浏览器

    :authority: prod.api.test.com
    :method: GET
    :path: /grpc/articleWithWholeBody/list/?Limit=200&Offset=0
    :scheme: https
    accept: application/json, text/plain, */*
    accept-encoding: gzip, deflate, br
    accept-language: zh-CN,zh;q=0.9
    cache-control: no-cache
    origin: https://www.test.com
    pragma: no-cache
    referer: https://www.test.com/
    sec-ch-ua: "Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"
    sec-ch-ua-mobile: ?0
    sec-fetch-dest: empty
    sec-fetch-mode: cors
    sec-fetch-site: cross-site
    user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36


    小程序模拟器

    Accept: */*
    Accept-Encoding: gzip, deflate, br
    Cache-Control: no-cache
    Connection: keep-alive
    content-type: application/json
    Host: prod.api.test.com
    Pragma: no-cache
    Referer: https://servicewechat.com/wx123/devtools/page-frame.html
    Sec-Fetch-Dest: empty
    Sec-Fetch-Mode: cors
    Sec-Fetch-Site: cross-site
    User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1 wechatdevtools/1.05.2107090 MicroMessenger/8.0.5 Language/zh_CN webview/


    【Response Headers】

    浏览器
    access-control-allow-headers: *
    access-control-allow-origin: *
    content-type: application/json; charset=utf-8
    date: Wed, 21 Jul 2021 06:47:46 GMT
    kratos-status-code: 0
    kratos-trace-id

    小程序 模拟器
    Access-Control-Allow-Headers: *
    Access-Control-Allow-Origin: *
    Connection: keep-alive
    Content-Type: application/json; charset=utf-8
    Date: Wed, 21 Jul 2021 06:51:47 GMT
    for-weapp-devtools: {"Date":["Wed, 21 Jul 2021 06:51:47 GMT"],"Content-Type":["application/json; charset=utf-8"],"Transfer-Encoding":["chunked"],"Connection":["keep-alive"],"Access-Control-Allow-Headers":["*"],"Access-Control-Allow-Origin":["*"],"Kratos-Status-Code":["0"],"Kratos-Trace-Id":[""]}
    Kratos-Status-Code: 0
    Kratos-Trace-Id
    Transfer-Encoding: chunked

    服务端代码打日志发现: 确实不同客户端从mysql取出的数据条数不一致;小程序少取了。

    解决办法: 调大mysql

    QueryTimeout

    时间。

    • Waiting (TTFB). The browser is waiting for the first byte of a response. TTFB stands for Time To First Byte. This timing includes 1 round trip of latency and the time the server took to prepare the response.

    同一接口,小程序环境的TTFB相比浏览器约大5倍。

    MySQL :: MySQL 8.0 Reference Manual :: 5.1.8 Server System Variables https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html

    net_read_timeout

    Command-Line Format --net-read-timeout=#
    System Variable net_read_timeout
    Scope Global, Session
    Dynamic Yes
    SET_VAR Hint Applies No
    Type Integer
    Default Value 30
    Minimum Value 1

    The number of seconds to wait for more data from a connection before aborting the read. When the server is reading from the client, net_read_timeout is the timeout value controlling when to abort. When the server is writing to the client, net_write_timeout is the timeout value controlling when to abort. See also replica_net_timeout and slave_net_timeout.

  • 相关阅读:
    P2149 [SDOI2009]Elaxia的路线
    电机学第一次课
    大素数区间快判模板
    网络流 最大权闭合子图
    DFS CCPC2017 南宁I题
    稳定婚姻问题模板
    CF438D 线段树 区间求和,区间求膜,单点更新
    对偶图 并查集 BZOJ4423
    BZOJ 1833 数字计数 数位DP
    过一点求对一个直线的垂足
  • 原文地址:https://www.cnblogs.com/rsapaper/p/15039567.html
Copyright © 2011-2022 走看看