【问题标题】:Is there any time difference between different responded requests,不同响应请求之间是否有时间差,
【发布时间】:2022-01-13 11:08:11
【问题描述】:

我对一件事感到好奇。

例如,假设我要在网站上更新我的电子邮件。我的用户 ID 是:1。

我成功请求的请求正文是:

currentEmail: example1@gmail.com,
newEmail: example2@gmail.com,
userId: 1

我会得到一个成功的回应。但是下面的请求会失败,因为没有任何 userId 为 2 的用户:

currentEmail: example1@gmail.com,
newEmail: example2@gmail.com,
userId: 2

这两者之间会有合理的时差吗?因为第二个请求不会触发任何数据库写入。

假设我将尝试使用 userId 查找用户。

GET api/findUser/{userId}

如果上面没有userId的用户,请求成功和失败之间会有时间差吗?

【问题讨论】:

    标签: api web-services performance-testing


    【解决方案1】:

    如果您“好奇” - 继续进行测量,实际结果将取决于 API 实现、DB 实现、DB 上的cachingORM 级别等。

    例如,如果在第一种情况下 API 只调用 SQL Update 语句 - 执行时间应该相似,但是如果 API 首先构建“用户”DTO - 尝试修改不存在的用户会更快.

    在后一种情况下,我的期望是尝试为不存在的用户获取信息会更快,但它也“取决于”。

    因此您需要检查关联代码execution footprintquery plans 甚至可能是load test the database separate from the API

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多