【问题标题】:What is the difference between a transaction and a transaction instance in Vugen?Vugen 中的事务和事务实例有什么区别?
【发布时间】:2017-03-23 17:36:17
【问题描述】:

我正在使用 HP Performance Center 的虚拟用户生成器,但我无法弄清楚 lr_start / end_transactionlr_start end_transaction_instance 之间的区别。我在支持中只能找到事务用于“跟踪持续时间”,事务实例用于“性能分析”,但我似乎无法找到分析结果的差异。

这两者之间有明显的区别吗?如果是这样,我可以看一个简短的例子吗?

【问题讨论】:

  • 旁注:在过去二十多年的使用中,我从未将 _instance() 变体用于 lr_start_transaction()。因此,虽然该功能存在,但我从未观察到直接需求。现在对于“分布式交易”,这是一个完全不同的故事......

标签: transactions loadrunner vugen


【解决方案1】:

LoadRunner 事务用于测量某些语句执行之间的时间。

LoadRunner 事务实例 用于对您在脚本中声明的现有事务 进行性能分析。您将事务按名称放入一个变量中,该变量稍后可用于分析其状态:获取其当前持续时间、状态等。

示例:

long id;
int status;

int amount_overdrawn = get_amount_overdrawn(); // Call some API

while (amount_overdrawn < LIMIT) {    
    // Notify that a transaction is starting
    lr_start_transaction("withdraw");

    status = bank_withdraw(500); // Call some API

    // End transaction with operation result - pass or fail

    if (status == 0)    
        lr_end_transaction("withdraw", LR_PASS);    
    else    
        lr_end_transaction("withdraw", LR_FAIL);

    amount_overdrawn = get_amount_overdrawn();    
}

// Set the transaction instance into a variable    
id = lr_start_transaction_instance("withdraw", 0);

status = bank_withdraw(500);

// End the transaction instance using the same variable 
lr_end_transaction_instance(id, LR_PASS);

【讨论】:

  • 我在网上看到过这个例子(事实上这是我能找到的唯一例子),但我仍然看不出它与普通交易有什么不同。您可以跟踪常规交易的持续时间,那么它还分析了什么?
  • 用处不大。这个想法是创建事务的实例,以便您可以通过实例而不是其名称来分析它。
猜你喜欢
  • 2015-05-10
  • 2014-03-26
  • 1970-01-01
  • 2019-06-22
  • 1970-01-01
  • 1970-01-01
  • 2011-07-21
  • 2015-01-18
  • 1970-01-01
相关资源
最近更新 更多