VM optimization to malloc

Hi there.
We are facing a client request situation, which is to make a better memory allocation to install certain application, named Proteus, from TOTVS.
It's happens that in order to check is the VM fullfil the requirement, we need to run a program, to makesome evaluation inside the VM. So, based on this evaluation, there's a table, which indicate if the server is suitable fo run the applcication or not.
Here's the table

Time to allocate memory block:
Up to 10s Great
Up to 15s Good
Up to 26s Bad
Above 26s Poor

So far, I have adjust CPU Units, CPU Models, Enabled/Disabled Ballooning, seted share in memory to 3000, 5000 and even to 15000.
Till now, nothing seems to affect the results, which is always something about 17000 or 16000 as you can see in the screenshot attached.

I hope anybody could point something to help out with this issue.

Bellow is the source code of the program used to performe the tests. Thanks a lot.
https://pastebin.com/KgJhB0qd
 
Gilberto,

estou trabalhando em um projeto que tive que usar o mallocio com proxmox para validar,

Ate o momento não consegui melhores sucessos, se puder compartilhar seus resultados agradeço.

Atenciosamente,
 
  • Like
Reactions: Gilberto Ferreira
Também estou com essa dor, procurei aplicar todas as práticas recomendadas e até o momento os resultados não são satisfatórios.

Servidor Dell T620.
Proxmox 8.2.2 instalado em HD série black
96GB de RAM
Swap desativada
Controladora PERC H710
2x SSD DC600M SATA 2,5 pol em RAID1
1 pcie NVME proprietário DELL

VMs do protheus e do sql com:

Protheus
Machine:
pc-q34-8.1
CPU:
Tipo Processador: Host (Xeon E5 2620 0 2Ghz)
Sockets: 02
vCPU:12
Numa: Habilitado
Memória: 24GB
Ballon: Habilitado

Discos:
Controladora: Virtio SCSI Single
Cache: write back
IOthread : Habilitado
Discard : Habilitado
SQL
Machine:
pc-q34-8.1
CPU:
Tipo Processador: Host (Xeon E5 2620 0 2Ghz)
Sockets: 02
vCPU:12
Numa: Habilitado
Memória: 32GB
Ballon: Habilitado

Discos:
Controladora: Virtio SCSI Single
Cache: write back
IOthread : Habilitado
Discard : Habilitado

Resultados com malloc...
c:\temp>mallocio-windows-1.2.0-x86_64.exe
Path - ./ | File - output.json
__ __ _ _ _ ___ ____ ___ ___
| \/ | / \ | | | | / _ \ / ___| |_ _/ _ \
| |\/| | / _ \ | | | | | | | | | _____| | | | |
| | | |/ ___ \| |___| |__| |_| | |__|_____| | |_| |
|_| |_/_/ \_\_____|_____\___/ \____| |___\___/
1.2.0 x86_64




TESTE 1
ALOCANDO BLOCO DE MEMORIA

TEMPO LEVADO PARA ALOCAR MEMORIA: 39.000000 segundos

RESULTADO DO TESTE: Pessimo -> NAO recomendado para o Protheus


TESTE 2
ESCRITA EM DISCO

TEMPO LEVADO PARA REALIZAR A ESCRITA EM DISCO: 3.000000 segundos



TESTE 3
LEITURA EM DISCO

TEMPO LEVADO PARA REALIZAR A LEITURA EM DISCO: 17.000000 segundos

RESULTADO DO TESTE: Bom -> NAO recomendado para o Protheus


***********************************************************************

TABELA DE REFERENCIA - ALOCAR BLOCO DE MEMORIA

Otimo - ate 10.000000 segundos (RECOMENDADO PARA O PROTHEUS)
Bom - ate 15.000000 segundos (NAO recomendado para o Protheus)
Ruim - ate 25.000000 segundos (NAO recomendado para o Protheus)
Pessimo - + 25.000000 segundos (NAO recomendado para o Protheus)

TABELA DE REFERENCIA - LEITURA EM DISCO

Otimo - ate 10.000000 segundos (RECOMENDADO PARA O PROTHEUS)
Bom - ate 25.000000 segundos (NAO recomendado para o Protheus)
Ruim - ate 26.000000 segundos (NAO recomendado para o Protheus)
Pessimo - + 26.000000 segundos (NAO recomendado para o Protheus)
 
Passando exatamente pela mesma experiencia. Nada que faça melhora os resultados.

Apenas para completar o código do malloc é o abaixo.
E realizando testes com o fio por exemplo, o fio mostra bons resultados, mas o tal malloc não.
Já observei em outros clientes que esse teste do malloc não retrata a real situação do servidor, pois já peguei situações que o malloc mostrou péssimos resultados, o SO em baremetal e o Protheus performando muito bem, olhando esse código, esse tal teste do malloc testa mais processador do que memória/disco em si. Não acreditem nele 100% para fins de análise.

//documentação referencia
https://tdn.totvs.com/display/public/PROT/MallocIO

//codigo
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
#include <fstream>

using namespace std;

void msg(int value, int message_type)
{
switch (message_type)
{
case 0:
printf(" __ __ _ _ _ ___ ____ ___ ___ \n");
printf(" | \\/ | / \\ | | | | / _ \\ / ___| |_ _/ _ \\ \n");
printf(" | |\\/| | / _ \\ | | | | | | | | | _____| | | | |\n");
printf(" | | | |/ ___ \\| |___| |__| |_| | |__|_____| | |_| |\n");
printf(" |_| |_/_/ \\_\\_____|_____\\___/ \\____| |___\\___/ \n");
printf(" xVs xArc\n");
printf(" \n");
printf(" \n");
break;
case 1:
printf(" \n");
printf(" \n");
printf("TESTE 1\n");
printf("ALOCANDO BLOCO DE MEMORIA\n");
printf(" \n");
break;
case 2:
printf(" \n");
printf(" \n");
printf("TESTE 2\n");
printf("ESCRITA EM DISCO\n");
printf(" \n");
break;
case 3:
printf(" \n");
printf(" \n");
printf("TESTE 3\n");
printf("LEITURA EM DISCO\n");
printf(" \n");
break;
default:
break;
}

}

int main()
{
void *var = 0;

time_t timer;
time_t timer2;
struct tm y2k = { 0 };
double seconds;
string msgret;

msg(1,0);

// ALOCANDO BLOCO DE MEMORIA
msg(1,1);

y2k.tm_hour = 0; y2k.tm_min = 0; y2k.tm_sec = 0;
y2k.tm_year = 100; y2k.tm_mon = 0; y2k.tm_mday = 1;
timer = time(NULL);

for (int i = 0; i < 300000000; i++)
{
var = malloc(100);
free(var);
}

timer2 = time(NULL);
seconds = timer2 - timer;

printf("TEMPO LEVADO PARA ALOCAR MEMORIA: %f segundos\n", seconds);
printf(" \n");
if (seconds <= 10) {
printf("RESULTADO DO TESTE: Otimo -> RECOMENDADO PARA O PROTHEUS\n");
}
else if (seconds > 10 && seconds <= 15) {
printf("RESULTADO DO TESTE: Bom -> NAO recomendado para o Protheus\n");
}
else if (seconds > 15 && seconds <= 25) {
printf("RESULTADO DO TESTE: Ruim -> NAO recomendado para o Protheus\n");
}
else {
printf("RESULTADO DO TESTE: Pessimo -> NAO recomendado para o Protheus\n");
}

// ESCRITA EM DISCO
msg(1,2);

y2k.tm_hour = 0; y2k.tm_min = 0; y2k.tm_sec = 0;
y2k.tm_year = 100; y2k.tm_mon = 0; y2k.tm_mday = 1;
timer = time(NULL);

ofstream TesteFile("teste.txt");

for (int i = 0; i < 7000000; i++){
TesteFile << "Teste\n";
}
remove("teste.txt");

timer2 = time(NULL);
seconds = timer2 - timer;

printf("TEMPO LEVADO PARA REALIZAR A ESCRITA EM DISCO: %f segundos\n", seconds);
printf(" \n");

ofstream TesteFile1("teste.txt");
for (int i = 0; i < 10000; i++){
TesteFile1 << "Teste\n";
}

// LEITURA EM DISCO
msg(1,3);

y2k.tm_hour = 0; y2k.tm_min = 0; y2k.tm_sec = 0;
y2k.tm_year = 100; y2k.tm_mon = 0; y2k.tm_mday = 1;
timer = time(NULL);

char * buffer;
FILE *pFile = fopen("teste.txt", "rb");
long lSize = ftell(pFile);
size_t result;
buffer = (char*)malloc(sizeof(char)*lSize);
for (int i = 0; i < 7000000; i++)
{
fseek(pFile, 0, SEEK_END);
result = fread(buffer, 1, lSize, pFile);
}
fclose(pFile);
free(buffer);

remove("teste.txt");

timer2 = time(NULL);
seconds = timer2 - timer;

printf("TEMPO LEVADO PARA REALIZAR A LEITURA EM DISCO: %f segundos\n", seconds);
printf(" \n");
if (seconds <= 10) {
printf("RESULTADO DO TESTE: Otimo -> RECOMENDADO PARA O PROTHEUS\n");
}
else if (seconds > 10 && seconds <= 25) {
printf("RESULTADO DO TESTE: Bom -> NAO recomendado para o Protheus\n");
}
else if (seconds > 25 && seconds <= 26) {
printf("RESULTADO DO TESTE: Ruim -> NAO recomendado para o Protheus\n");
}
else {
printf("RESULTADO DO TESTE: Pessimo -> NAO recomendado para o Protheus\n");
}

printf(" \n");
printf(" \n");
printf(" ***********************************************************************\n");
printf(" \n");
printf(" TABELA DE REFERENCIA - ALOCAR BLOCO DE MEMORIA\n");
printf(" \n");
printf("Otimo - ate 10.000000 segundos (RECOMENDADO PARA O PROTHEUS)\n");
printf("Bom - ate 15.000000 segundos (NAO recomendado para o Protheus)\n");
printf("Ruim - ate 25.000000 segundos (NAO recomendado para o Protheus)\n");
printf("Pessimo - + 25.000000 segundos (NAO recomendado para o Protheus)\n");
printf(" \n");

printf(" TABELA DE REFERENCIA - LEITURA EM DISCO\n");
printf(" \n");
printf("Otimo - ate 10.000000 segundos (RECOMENDADO PARA O PROTHEUS)\n");
printf("Bom - ate 25.000000 segundos (NAO recomendado para o Protheus)\n");
printf("Ruim - ate 26.000000 segundos (NAO recomendado para o Protheus)\n");
printf("Pessimo - + 26.000000 segundos (NAO recomendado para o Protheus)\n");
printf(" \n");
}
 
Last edited: