|
| 1 | +format longG |
| 2 | +clear all;close all; |
| 3 | +stringREDIS = 'CPU-data-as-seriestocolumns-2021-06-04 23_48_26'; |
| 4 | +stringMONGO = 'CPU-data-as-seriestocolumns-2021-06-04 23_50_23'; |
| 5 | +bytesDevider = 1000000; |
| 6 | +bytesDevider = 1; |
| 7 | +dataID = '4SUMREDISMONGO'; |
| 8 | +data = readtable(strcat('/Users/mymac/Documents/SCRIPTSHEET/SKRIPSI/data_grafana/4/redis/',strcat(stringREDIS,'.csv')), 'ReadVariableNames', false, 'HeaderLines', 2); |
| 9 | +data2 = readtable(strcat('/Users/mymac/Documents/SCRIPTSHEET/SKRIPSI/data_grafana/4/mongo/',strcat(stringMONGO,'.csv')), 'ReadVariableNames', false, 'HeaderLines', 2); |
| 10 | + |
| 11 | +% ini untuk format date seperti halnya di jmeter ya |
| 12 | +% x = seconds((datenum(datestr(data.ElapsedTime, 'yyyy-mm-dd hh:MM:ss.fff')) - datenum(datestr(data{1,1}, 'yyyy-mm-dd hh:MM:ss.fff'))) * 100000); |
| 13 | +% x.Format = 'hh:mm:ss'; |
| 14 | + |
| 15 | +markers = {'+','x','*','o','x','v','d','^','s','>','<','v','p','h','p','v','<','>','s','^','d','v','x','o','.','*'}; |
| 16 | +colors = {'r','g','b','k','y','c','g','r','b','m','k','y'}; |
| 17 | +lines = {'-','--',':','-.',':','--'}; |
| 18 | +line_width = 0.9; |
| 19 | +marker_size = 5; |
| 20 | +marker_counter = 1; |
| 21 | +color_counter = 1; |
| 22 | +line_counter = 1; |
| 23 | +ylabels='Response times (ms)'; |
| 24 | +ylabelslat = 'Mega Bytes (MB)'; |
| 25 | +ylabelscpu='Number of core CPU'; |
| 26 | +ylabels1='Number of threads'; |
| 27 | +ylabels2='Mega Bytes (MB)'; |
| 28 | +yredis = 'Command executed per second'; |
| 29 | +ylabelstruput='Mega Bytes (MB) per second'; |
| 30 | +ylabels3='TCP connections'; |
| 31 | +ythread='Number of active threads'; |
| 32 | +%legend_base_name = 'Worker-'; |
| 33 | +% legend_base_name = 'All nodes'; |
| 34 | + |
| 35 | + |
| 36 | +% kalo ini format number dalam menit elapsed time |
| 37 | +x = (datenum(datestr(data{:,1}, 'yyyy-mm-dd hh:MM:ss.fff')) - datenum(datestr(data{1,1}, 'yyyy-mm-dd hh:MM:ss.fff'))) * 100000/60; |
| 38 | +x2 = (datenum(datestr(data2{:,1}, 'yyyy-mm-dd hh:MM:ss.fff')) - datenum(datestr(data2{1,1}, 'yyyy-mm-dd hh:MM:ss.fff'))) * 100000/60; |
| 39 | +% ini untuk data x yang pure number aja, bukan elapsed time |
| 40 | +%x = data{:,1}; |
| 41 | + |
| 42 | +% REDIS REMOVE FIRST COLUMN AND SUM ALL ROW |
| 43 | + temp_data = data; |
| 44 | + temp_data(:,1) = []; |
| 45 | + A = table2array(temp_data); |
| 46 | + A(isnan(A))=0; |
| 47 | +% A = rand(1000, 4); % Test data |
| 48 | +B = [A, sum(A, 2)/bytesDevider]; %1000000 |
| 49 | +B(isnan(B))=0; |
| 50 | + |
| 51 | +%MONGO |
| 52 | + temp_data2 = data2; |
| 53 | + temp_data2(:,1) = []; |
| 54 | + A2 = table2array(temp_data2); |
| 55 | + A2(isnan(A2))=0; |
| 56 | +% A = rand(1000, 4); % Test data |
| 57 | +B2 = [A2, sum(A2, 2)/bytesDevider]; %1000000 |
| 58 | +B2(isnan(B2))=0; |
| 59 | + |
| 60 | +% disp(B(:,size(B,2))); |
| 61 | + |
| 62 | +% b_ex = [B,B2]; |
| 63 | + |
| 64 | +hold on |
| 65 | + |
| 66 | +if(max(B(:,size(B,2)))*1.2 > max(B2(:,size(B2,2)))*1.2) |
| 67 | + ylimit = max(B(:,size(B,2)))*1.2; |
| 68 | +else |
| 69 | + ylimit = max(B2(:,size(B2,2)))*1.2; |
| 70 | +end |
| 71 | + |
| 72 | +yyaxis left |
| 73 | +plot(x,B(:,size(B,2)),strcat(lines{line_counter},strcat(colors{color_counter},markers{marker_counter})),'MarkerSize',marker_size,'LineWidth',line_width) |
| 74 | +ylim([0 ylimit]) |
| 75 | +marker_counter = marker_counter + 1; |
| 76 | +color_counter =color_counter+ 1; |
| 77 | +xlabel('Elapsed time (minutes)','FontSize',15); |
| 78 | +ylabel(yredis,'FontSize',15); |
| 79 | +yyaxis right |
| 80 | +plot(x2,B2(:,size(B2,2)),strcat(lines{line_counter},strcat(colors{color_counter},markers{marker_counter})),'MarkerSize',marker_size,'LineWidth',line_width,'color',[0 0.7 0]) |
| 81 | +ylim([0 ylimit]) |
| 82 | +set(gca,'Yticklabel',[]) |
| 83 | +% y2lbl= ylabel('Document operations per second','FontSize',15); |
| 84 | + |
| 85 | + |
| 86 | +box on; |
| 87 | +grid on; |
| 88 | + |
| 89 | +ax = gca; |
| 90 | +ax.YAxis(1).Exponent = 0; |
| 91 | +ax.YAxis(2).Exponent = 0; |
| 92 | +% ax.YAxis(1).Color = 'r'; |
| 93 | +% ax.YAxis(2).Color = [0 0.7 0]; |
| 94 | +ax.YAxis(1).Color = 'k'; |
| 95 | +ax.YAxis(2).Color = [0 0.7 0]; |
| 96 | +ax.GridLineStyle = ':'; |
| 97 | +ax.GridAlpha = 0.3; |
| 98 | +ax.LineWidth = 0.9; |
| 99 | +set(gca,'FontSize',16) |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + legend('Redis Cluster','MongoDB Sharded'); |
| 105 | + |
| 106 | +legend('show'); |
| 107 | +lgd = legend; |
| 108 | +%lgd.FontSize=7; |
| 109 | +lgd.Location = 'northWest'; |
| 110 | + |
| 111 | +set(gcf,'Units','Inches'); |
| 112 | + |
| 113 | +%title({'Memory Utilization HTTP 50K Threads','Instance Type (m5.xlarge/m5a.xlarge)'},'FontSize',14); |
| 114 | +%title({'Database Operations HTTP 50K Threads','Instance Type (m5.xlarge/m5a.xlarge)'},'FontSize',14); |
| 115 | +%title({'Node Command SUM: redis cluster (HTTP 50K Threads)','Instance Type (m5.xlarge/m5a.xlarge)'},'FontSize',14); |
| 116 | + title({'CPU Utilization HTTP 50K Threads','Instance Type (m5.xlarge/m5a.xlarge)'},'FontSize',14); |
| 117 | +%title({'Network RX SUM: ingress (HTTP 50K Threads)','Instance Type (m5.xlarge/m5a.xlarge)'},'FontSize',14); |
| 118 | +%title({'Network TX SUM: ingress (HTTP 50K Threads)','Instance Type (m5.xlarge/m5a.xlarge)'},'FontSize',14); |
| 119 | + |
| 120 | +%title({'HTTP Response Times over Time (50K Threads)','Instance Type (m5.xlarge/m5a.xlarge)'},'FontSize',14); |
| 121 | +%title({'HTTP Latencies over Time (50K Threads)','Instance Type (m5.xlarge/m5a.xlarge)'},'FontSize',14); |
| 122 | +%title({'Bytes Throughput over Time (50K Threads)','Instance Type (m5.xlarge/m5a.xlarge)'},'FontSize',15); |
| 123 | + |
| 124 | + |
| 125 | +%ylim([0,max(B(:,size(B,2)))*1.2]); |
| 126 | +% xlim([min(x),max(x)]) |
| 127 | +pos = get(gcf,'Position'); |
| 128 | +set(findall(gcf,'-property','FontName'),'FontName','Times New Roman'); |
| 129 | +set(gcf,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)]); |
| 130 | +print(gcf,'-dpdf',strcat('/Users/mymac/Documents/SCRIPTSHEET/SKRIPSI/hasilgrafik/',strcat(dataID,stringREDIS,stringMONGO)),'-r0'); |
| 131 | +savefig(strcat('/Users/mymac/Documents/SCRIPTSHEET/SKRIPSI/hasilgrafik/',strcat(dataID,stringREDIS,stringMONGO))); |
| 132 | +% print -dpdf -painters hasilgrafik/1a |
| 133 | +colormap(gcf,hot); |
| 134 | +hold off; |
| 135 | + |
0 commit comments