- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们使用 LoadRunner 来运行应用程序的性能测试。测试通常用 Ansi-C 编写。
我们有一个简单的base64编码函数:
void base64encode(char *src, char *dest, int srcLen, int destLen)
{
int i=0;
int slen= srcLen;
for(i=0;i<slen && i<destLen;i+=3,src+=3)
{
*(dest++)=base64encode_lut[(*src&0xFC)>>0x2];
*(dest++)=base64encode_lut[(*src&0x3)<<0x4|(*(src+1)&0xF0)>>0x4];
*(dest++)=((i+1)<slen)?base64encode_lut[(*(src+1)&0xF)<<0x2|(*(src+2)&0xC0)>>0x6]:'=';
*(dest++)=((i+2)<slen)?base64encode_lut[*(src+2)&0x3F]:'=';
}
*dest='\0';
}
此代码在开发人员计算机(64 位 Windows 10 计算机)上运行时,代码在一秒内运行一个简单图像(srcLen
大约 7k)。当在生产服务器(32 位 Windows 2012、VM)上运行时,同一镜像的执行时间为 10 到 20 分钟。
谁能解释一下为什么以及如何避免这个问题?我不确定是 LoadRunner 的问题还是代码的问题。
编辑:添加调用编码函数的代码:
long infile; // file pointer
char *buffer; // buffer to read file contents into
char *filename = "DFC_COLOR.jpg"; // file to read
int fileLen; // file size
int bytesRead; // bytes read from file
char *encoded;
int dest_size;
web_set_max_html_param_len("999999999");
infile = fopen(filename, "rb");
if (!infile) {
lr_error_message("Unable to open file %s", filename);
return;
}
// get the file length
fseek(infile, 0, SEEK_END);
fileLen = ftell(infile);
fseek(infile, 0, SEEK_SET);
lr_log_message("File length is: %9d bytes.", fileLen);
// Allocate memory for buffer to read file
buffer = (char *)malloc(fileLen + 1);
if (!buffer) {
lr_error_message("Could not malloc %10d bytes", fileLen + 1);
fclose(infile);
return;
}
// Read file contents into buffer
bytesRead = fread(buffer, 1, fileLen, infile);
if (bytesRead != fileLen)
{
lr_error_message("File length is %10d bytes but only read %10d bytes", fileLen, bytesRead);
}
else
{
lr_log_message("Successfully read %9d bytes from file: ", bytesRead);
}
fclose(infile);
// Save the buffer to a loadrunner parameter
lr_save_var(buffer, bytesRead, 0, "fileDataParameter");
// calculate the destination size
dest_size = 1 + ((bytesRead + 2) / 3 * 4);
encoded = (char *)malloc(dest_size);
memset(encoded, 0, dest_size);
// encode the buffer
base64encode(buffer, encoded, bytesRead, dest_size);
最佳答案
在非共享/代理资源物理机上运行单个虚拟用户,看看是否具有相同的性能。您不想确定虚拟机环境中的优先级和资源池。您可能正在高度过载的 VM 主机上运行,并且您只需等待虚拟机管理程序决定谁在何时获得给定的资源集。将单个虚拟用户移动到单个硬件主机可以提供通用的苹果与梨(橙子与金橘)的比较基础。
LoadRunner 还包括符合 RFC 的 Base64 编码和解码算法作为其核心集的一部分,因此您无需重新编码。通常,这用作 SMTP 或 DNS 虚拟用户的一部分,但您可以加载 DLL、对功能进行原型(prototype)设计并继续前进。您可以在\include\mic_socket.h 头文件中找到现有的函数原型(prototype)。这是一篇关于如何实现这一点的精彩文章。我知道编辑们会尖叫并将其降级为外部链接,因此您可能希望快速捕获链接
https://northwaysolutions.com/blog/loadrunner-vugen-encoding-and-decoding-base64/#.WL1vZxLytlc
处理此问题的另一种方法是作为数据格式扩展。解码已作为基本扩展涵盖,因此您只需在需要时处理编码即可。使用 Google 提取对 Loadrunner、DFE 和 base64 的引用以获取适当的项目。您还可以在本地文档集中找到 DFE 开发人员指南,该指南随 LoadRunner 副本一起安装。
关于c - 为什么这段代码在服务器上执行需要很长时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42618075/
这个问题在这里已经有了答案: Isn't an Int64 equal to a long in C#? (2 个答案) 关闭 9 年前。 它不应该是一个整数类型吗? 这样,一些使用 int 的函数
当我遇到一些我想知道的事情时,我正忙着解析一个二进制文件。 Stream.Position属性的类型为Int64或long。为什么是这样?因为流中的位置不能为负,所以使用 UInt64 不是更有意义吗
所以第一部分是我从用户那里获得输入,在本例中,输入是“1”作为从另一个函数接收的字符值。 printf ("\nPlease enter 1, 2, 3 or q: "); option =
我正在尝试使用以下代码从 REST 服务返回 JSON: $categories = $categoriesController->listAll(); if($categories){ hea
我阅读了文档,它说 long 是 %li,但打印输出返回为 -2147024891。是什么赋予了? 最佳答案 您甚至没有提供要打印的号码,但我猜您已经无意中发现了签名打印和未签名打印之间的区别。 使用
我正在创建自定义购物车,我正在构建一个查询,该查询从检索我刚刚保存到购物车表中的 session_id 开始。我知道这个值被保存了,我在 mysql 命令行运行这个查询,它返回我需要的但我没有将值放入
我有一个包含 textView 的 scrollView。如果文本很长并且不适合屏幕,我想增加 textView 高度(我想我可以通过添加 NSLayoutConstraint outlet 并修改它
我有一个基本的数据库处理程序类,其中有一个使用 PDO::FETCH_ASSOC 参数返回结果集的公共(public)方法: public function resultSet() { $th
在后台线程中,我调用 PublishSubject.onNext(); 并在主线程中通过 subscribe(PublishSubject.filter(message -> message.getI
我想知道为什么 Amazon Web Services 控制台登录页面有这么长的 url?为什么不只发布数据而不显示其中包含大量数据的冗长 url。以这种方式实现有什么充分的理由吗? 最佳答案 我认为
这个问题在这里已经有了答案: Can I mix MySQL APIs in PHP? (4 个答案) 关闭 6 年前。 希望我犯了一个快速而明显的错误,我浏览了 previous question
我得到了答案:如果我禁用了cookie,那么使用URL重定向我可以传递JSESSIONID,但我的URL已经很长,因为我使用它有约束的GET方法。那怎么办我应该使用我的 session 吗?我希望我的
目前,当我使用 DOMDocument 对象并调用 saveHTML() 时,它会自动添加一些我不需要的 html 标签。我尝试了此处建议的解决方案 ( https://stackoverflow.c
我是一名优秀的程序员,十分优秀!