From 29e69545814c4c120518f9244c3e7c43293cbccb Mon Sep 17 00:00:00 2001 From: timkoopmans Date: Tue, 4 Feb 2025 16:13:34 +1100 Subject: [PATCH] more config --- dist/assets/index-BdfTM9Up.js | 1 - dist/assets/index-CjpezalN.js | 1 + dist/index.html | 2 +- src/calculator.js | 4 ++-- 4 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 dist/assets/index-BdfTM9Up.js create mode 100644 dist/assets/index-CjpezalN.js diff --git a/dist/assets/index-BdfTM9Up.js b/dist/assets/index-BdfTM9Up.js deleted file mode 100644 index 57c796a..0000000 --- a/dist/assets/index-BdfTM9Up.js +++ /dev/null @@ -1 +0,0 @@ -(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const d of o.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function a(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=a(s);fetch(s.href,o)}})();const e={pricing:"demand",demand:1e4,baseline:1e4,peak:1e5,peakWidth:1,hoursPerMonth:730,itemSizeB:1024,storageGB:512,ratio:50,tableClass:"standard",pricePerRRU:125e-9,pricePerWRU:625e-9,pricePerRRU_IA:155e-9,pricePerWRU_IA:78e-8,pricePerRCU:13e-5,pricePerRRCU:25e-6,pricePerWCU:65e-5,pricePerRWCU:128e-6,pricePerRCU_IA:16e-5,pricePerWCU_IA:81e-5,regions:0,pricePerRWRU:625e-9,pricePerRWRU_IA:78e-8,priceIntraRegPerGB:.02,daxNodes:0,daxInstanceClassCosts:{r5Large:.255,r5XLarge:.509,r52XLarge:1.017,r54XLarge:2.034,r58XLarge:4.069,r512XLarge:6.117,r516XLarge:8.137,r524XLarge:12.234},scyllaPrices:[{family:"i4i",instance:"i4i.xlarge",baseline:78e3,peak:12e4,storage:937,price:3.325},{family:"i3en",instance:"i3en.xlarge",baseline:39e3,peak:6e4,storage:2.44*1024,price:4.378}]};function U(t,n,a,i){for(let s=3;s<1e3;s+=3){const o=3/s*t/n<=.9,d=i/3*s>=a;if(o&&d)return s}return 3}function b(){const t=e.storageGB*.5,n=.2,a=U(t,e.scyllaPrices[0].storage,e.totalOpsSec,e.scyllaPrices[0].baseline),i=U(t,e.scyllaPrices[1].storage,e.totalOpsSec,e.scyllaPrices[1].baseline),s=e.scyllaPrices[0].price,o=e.scyllaPrices[1].price,d=a/3*s*730*(1-n),r=i/3*o*730*(1-n),g=r<=d?r:d,C=r<=d?"i3en":"i4i",I=r<=d?i:a;return{scyllaCost:g,nodeCount:I,family:C}}function T(){e.pricing=document.querySelector('input[name="pricing"]:checked').value}function W(){e.tableClass=document.getElementById("tableClass").value}function S(){e.regions=parseInt(document.getElementById("regions").value)}function w(){e.daxNodes=parseInt(document.getElementById("daxNodes").value),e.daxInstanceClass=document.getElementById("daxInstanceClass").value}function D(){e.storageGB=parseInt(document.getElementById("storageGB").value),e.itemSizeKB=parseInt(document.getElementById("itemSizeB").value)*(1/1024),e.itemSizeKB=e.itemSizeKB>1?Math.floor(e.itemSizeKB):e.itemSizeKB}function $(){e.readStronglyConsistent=parseInt(document.getElementById("readConst").value)/100,e.readEventuallyConsistent=1-e.readStronglyConsistent,e.readTransactional=parseInt(document.getElementById("readTrans").value)/100,e.readNonTransactional=1-e.readTransactional,e.writeTransactional=parseInt(document.getElementById("writeTrans").value)/100,e.writeNonTransactional=1-e.writeTransactional}function M(){e.readRatio=parseInt(document.getElementById("ratio").value)/100,e.writeRatio=1-e.readRatio}function L(){e.demand=parseInt(document.getElementById("demand").value)}function N(){e.peakHours=e.peakWidth*30,e.baselineHours=e.hoursPerMonth-e.peakHours,e.reservedCapacity=parseInt(document.getElementById("reservedCapacity").value)/100}function z(){e.writeRequestUnitsPerItem=Math.ceil(e.itemSizeKB),e.readRequestUnitsPerItem=Math.ceil(e.itemSizeKB/4),e.baselineWCUNonTransactional=e.baseline*e.writeRatio*e.writeNonTransactional*e.writeRequestUnitsPerItem,e.baselineWCUTransactional=e.baseline*e.writeRatio*e.writeTransactional*2*e.writeRequestUnitsPerItem,e.baselineWCUTotal=e.baselineWCUNonTransactional+e.baselineWCUTransactional,e.reservedWCU=e.baselineWCUTotal*e.reservedCapacity,e.reservedWCU=Math.ceil(e.reservedWCU/100)*100,e.provisionedBaselineWCU=e.baselineWCUTotal-e.reservedWCU,e.provisionedBaselineWCU=Math.ceil(Math.max(e.provisionedBaselineWCU,0)),e.provisionedBaselineWCUHours=Math.ceil(e.provisionedBaselineWCU*e.baselineHours),e.peakWCUNonTransactional=e.peak*e.writeRatio*e.writeNonTransactional*e.writeRequestUnitsPerItem,e.peakWCUTransactional=e.peak*e.writeRatio*e.writeTransactional*2*e.writeRequestUnitsPerItem,e.peakWCUTotal=e.peakWCUNonTransactional+e.peakWCUTransactional,e.provisionedPeakWCU=e.peakWCUTotal-e.reservedWCU,e.provisionedPeakWCU=Math.ceil(Math.max(e.provisionedPeakWCU,0)),e.provisionedPeakWCUHours=Math.ceil(e.provisionedPeakWCU*e.peakHours),e.provisionedTotalWCUHours=Math.ceil(e.provisionedBaselineWCUHours+e.provisionedPeakWCUHours),e.dynamoCostProvisionedWCU=e.provisionedTotalWCUHours*(e.tableClass==="standard"?e.pricePerWCU:e.pricePerWCU_IA),e.dynamoCostReplication=e.regions*e.provisionedTotalWCUHours*(e.tableClass==="standard"?e.pricePerRWRU:e.pricePerRWRU_IA),e.dynamoCostReservedWCU=e.reservedWCU*128e-6*730,e.dynamoCostMonthlyWCU=e.dynamoCostProvisionedWCU+e.dynamoCostReservedWCU+e.dynamoCostReplication,e.dynamoCostUpfrontWCU=e.reservedWCU*1.5,e.baselineRCUNonTransactional=e.baseline*e.readRatio*e.readEventuallyConsistent*.5*e.readRequestUnitsPerItem,e.baselineRCUStronglyConsistent=e.baseline*e.readRatio*e.readStronglyConsistent*e.readRequestUnitsPerItem,e.baselineRCUTransactional=e.baseline*e.readRatio*e.readTransactional*2*e.readRequestUnitsPerItem,e.baselineRCUTotal=e.baselineRCUNonTransactional+e.baselineRCUStronglyConsistent+e.baselineRCUTransactional,e.reservedRCU=e.baselineRCUTotal*e.reservedCapacity,e.reservedRCU=Math.ceil(e.reservedRCU/100)*100,e.provisionedBaselineRCU=e.baselineRCUTotal-e.reservedRCU,e.provisionedBaselineRCU=Math.ceil(Math.max(e.provisionedBaselineRCU,0)),e.provisionedBaselineRCUHours=Math.ceil(e.provisionedBaselineRCU*e.baselineHours),e.peakRCUNonTransactional=e.peak*e.readRatio*e.readEventuallyConsistent*.5*e.readRequestUnitsPerItem,e.peakRCUStronglyConsistent=e.peak*e.readRatio*e.readStronglyConsistent*e.readRequestUnitsPerItem,e.peakRCUTransactional=e.peak*e.readRatio*e.readTransactional*2*e.readRequestUnitsPerItem,e.peakRCUTotal=e.peakRCUNonTransactional+e.peakRCUStronglyConsistent+e.peakRCUTransactional,e.provisionedPeakRCU=e.peakRCUTotal-e.reservedRCU,e.provisionedPeakRCU=Math.ceil(Math.max(e.provisionedPeakRCU,0)),e.provisionedPeakRCUHours=Math.ceil(e.provisionedPeakRCU*e.peakHours),e.provisionedTotalRCUHours=Math.ceil(e.provisionedBaselineRCUHours+e.provisionedPeakRCUHours),e.dynamoCostProvisionedRCU=e.provisionedTotalRCUHours*(e.tableClass==="standard"?e.pricePerRCU:e.pricePerRCU_IA),e.dynamoCostReservedRCU=e.reservedRCU*25e-6*730,e.dynamoCostMonthlyRCU=e.dynamoCostProvisionedRCU+e.dynamoCostReservedRCU,e.dynamoCostUpfrontRCU=e.reservedRCU*.3,e.dynamoCostProvisionedMonthly=e.dynamoCostMonthlyWCU+e.dynamoCostMonthlyRCU,e.dynamoCostProvisionedUpfront=e.dynamoCostUpfrontWCU+e.dynamoCostUpfrontRCU,e.dynamoCostProvisioned=e.dynamoCostProvisionedMonthly+e.dynamoCostProvisionedUpfront/12}function q(){e.readRequestUnitsPerItem=Math.ceil(e.itemSizeKB/4),e.writeRequestUnitsPerItem=Math.ceil(e.itemSizeKB),e.numberReads=e.demand*e.readRatio*3600*e.hoursPerMonth,e.readRequestUnits=e.numberReads*e.readEventuallyConsistent*.5*e.readRequestUnitsPerItem+e.numberReads*e.readStronglyConsistent*e.readRequestUnitsPerItem+e.numberReads*e.readTransactional*2*e.readRequestUnitsPerItem,e.dynamoCostDemandReads=e.readRequestUnits*(e.tableClass==="standard"?e.pricePerRRU:e.pricePerRRU_IA),e.numberWrites=e.demand*e.writeRatio*3600*e.hoursPerMonth,e.writeRequestUnits=e.numberWrites*e.writeNonTransactional*e.writeRequestUnitsPerItem+e.numberWrites*e.writeTransactional*2*e.writeRequestUnitsPerItem,e.dynamoCostDemandWrites=e.writeRequestUnits*(e.tableClass==="standard"?e.pricePerWRU:e.pricePerWRU_IA),e.dynamoCostReplication=e.regions*e.writeRequestUnits*(e.tableClass==="standard"?e.pricePerRWRU:e.pricePerRWRU_IA),e.dynamoCostDemand=e.dynamoCostDemandReads+e.dynamoCostDemandWrites+e.dynamoCostReplication}function F(){e.totalReadsKB=e.readsOpsSec*3600*e.hoursPerMonth*e.itemSizeKB,e.totalWritesKB=e.writesOpsSec*3600*e.hoursPerMonth*e.itemSizeKB,e.totalReplicatedWritesGB=e.regions*e.totalWritesKB/1024/1024,e.dynamoCostNetwork=e.totalReplicatedWritesGB*e.priceIntraRegPerGB}function G(){e.daxInstanceClassCost=e.daxInstanceClassCosts[e.daxInstanceClass],e.dynamoDaxCost=e.daxNodes*e.hoursPerMonth*e.daxInstanceClassCost}function K(){e.dynamoCostStorage=e.storageGB*.25}function H(){e.readsOpsSec=e.pricing==="demand"?e.demand*e.readRatio:e.baseline*e.readRatio,e.writesOpsSec=e.pricing==="demand"?e.demand*e.writeRatio:e.baseline*e.writeRatio,e.totalOpsSec=e.readsOpsSec+e.writesOpsSec}function O(t,n){let a=[`itemSizeKB: ${e.itemSizeKB} KB`,`storageGB: ${e.storageGB} GB`,`totalOpsSec: ${e.totalOpsSec.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}`];e.pricing==="demand"?a=a.concat([`dynamoCostDemandReads: $${e.dynamoCostDemandReads.toFixed(2)}`,`dynamoCostDemandWrites: $${e.dynamoCostDemandWrites.toFixed(2)}`,`dynamoCostDemand: $${e.dynamoCostDemand.toFixed(2)}`]):a=a.concat([`dynamoCostMonthlyWCU: $${e.dynamoCostMonthlyWCU.toFixed(2)}`,`dynamoCostUpfrontWCU: $${e.dynamoCostUpfrontWCU.toFixed(2)}`,`dynamoCostMonthlyRCU: $${e.dynamoCostMonthlyRCU.toFixed(2)}`,`dynamoCostUpfrontRCU: $${e.dynamoCostUpfrontRCU.toFixed(2)}`]),a=a.concat([`dynamoCostNetwork: $${e.dynamoCostNetwork.toFixed(2)}`,`dynamoCostReplication: $${e.dynamoCostReplication.toFixed(2)}`,`dynamoDaxCost: $${e.dynamoDaxCost.toFixed(2)}`,`dynamoCostStorage: $${e.dynamoCostStorage.toFixed(2)}`,`dynamoCostTotal: $${e.dynamoCostTotal.toFixed(2)}`,`scyllaCost: $${t.scyllaCost.toFixed(2)}`,`costRatio: ${n}`,`nodeCount: ${t.nodeCount}`,`family: ${t.family}`]),console.log("config",e),Q(a)}function A(){const t=l.data.datasets[0].data,n=l.data.datasets[1].hidden?2:1,a=l.data.datasets[n].data;let i=0,s=0;for(let r=1;r=1e9?(t/1e9).toFixed(0)+"B":t>=1e6?(t/1e6).toFixed(0)+"M":t>=1e3?(t/1e3).toFixed(0)+"K":t>=1?t.toFixed(0):t.toString()}function V(){const t=new URLSearchParams(window.location.search);t.get("workload")&&(e.workload=t.get("workload")),t.get("demand")&&(e.demand=parseInt(t.get("demand"))),t.get("baseline")&&(e.baseline=parseInt(t.get("baseline"))),t.get("peak")&&(e.peak=parseInt(t.get("peak"))),t.get("peakWidth")&&(e.peakWidth=parseInt(t.get("peakWidth"))),t.get("storageGB")&&(e.storageGB=parseInt(t.get("storageGB"))),t.get("itemSizeB")&&(e.itemSizeB=parseInt(t.get("itemSizeB"))),t.get("ratio")&&(e.ratio=parseInt(t.get("ratio"))),t.get("pricing")&&(e.pricing=t.get("pricing")),t.get("regions")&&(e.regions=parseInt(t.get("regions"))),t.get("daxNodes")&&(e.daxNodes=parseInt(t.get("daxNodes")))}let x;function X(){clearTimeout(x),x=setTimeout(()=>{const t=new URLSearchParams(window.location.search);t.set("pricing",e.pricing),t.set("storageGB",e.storageGB),t.set("itemSizeB",e.itemSizeB),t.set("tableClass",e.tableClass),t.set("ratio",e.ratio),e.pricing==="demand"?(t.delete("baseline"),t.delete("peak"),t.delete("peakWidth"),t.set("demand",e.demand)):(t.delete("demand"),t.set("baseline",e.baseline),t.set("peak",e.peak),t.set("peakWidth",e.peakWidth)),e.daxNodes===0?(t.delete("daxNodes"),t.delete("daxInstanceClass")):(t.set("daxNodes",e.daxNodes),t.set("daxInstanceClass",e.daxInstanceClass)),e.regions===0?t.delete("regions"):t.set("regions",e.regions),window.history.replaceState({},"",`${window.location.pathname}?${t}`)},1e3)}function c(){X(),J(),A(),_()}function Q(t){const n=document.getElementById("costSavedTip");n.style.display="block",n.innerHTML=t.map(a=>{const[i,s]=a.split(": ");return`
${i}:${s}
`}).join("")}const j=document.getElementById("chart").getContext("2d");function h(t,n,a){const i=[],s=Math.floor((24-a)/2),o=s+a;for(let d=0;d<=24;d++)d>=s&&d({x:n,y:e.demand}))}function Y(t){switch(t){case"twiceDaily":return[{x:0,y:5e3},{x:6,y:1e4},{x:8,y:1e5},{x:10,y:1e4},{x:12,y:5e3},{x:16,y:1e4},{x:18,y:1e5},{x:20,y:1e4},{x:24,y:5e3}];case"constant":return Array.from({length:25},(n,a)=>({x:a,y:5e4}));case"morningPeak":default:return[]}}function J(){l.data.datasets[1].data=k(),l.data.datasets[2].data=h(e.baseline,e.peak,e.peakWidth),l.update()}const l=new Chart(j,{type:"scatter",data:{datasets:[{label:"Workload",borderColor:"#0F1040",backgroundColor:"rgba(170,170,170,0.5)",data:Y(e.workload),fill:!0,showLine:!0,borderDash:[4,4],tension:.3},{label:"On Demand",data:k(),borderColor:"#0F1040",backgroundColor:"rgba(15,16,64,0.8)",showLine:!0,pointRadius:0,fill:!0,tension:.1},{label:"Provisioned",data:h(),borderColor:"#0F1040",backgroundColor:"rgba(15,16,64,0.8)",fill:!0,tension:.1,showLine:!0,pointRadius:0,hidden:!0}]},options:{plugins:{legend:{display:!1},title:{display:!1},tooltip:{callbacks:{label:function(t){return"Workload: "+m(t.raw.y)+" ops/sec"}}},dragData:{round:1,showTooltip:!0,onDrag:function(t,n,a,i){i.x=Math.round(i.x),i.y=Math.round(i.y/1e3)*1e3},onDragEnd:function(t,n,a,i){l.update(),c()},dragX:!0,dragY:!0}},scales:{x:{min:0,max:24,title:{display:!1},ticks:{stepSize:1,callback:function(t){return t.toString().padStart(2,"0")+":00"}}},y:{type:"logarithmic",title:{display:!0,text:"op/sec"},min:1e3,max:1e7,ticks:{callback:function(t){return t===1e3?"1K":t===1e4?"10K":t===1e5?"100K":t===1e6?"1M":t===1e7?"10M":null}}}}}});function u(t,n,a,i){const s=document.getElementById(t),o=document.getElementById(n),d=document.getElementById(a);s.addEventListener("click",function(r){r.stopPropagation(),o.value=parseInt(d.value),s.style.display="none",o.style.display="inline",setTimeout(()=>o.focus(),0)}),o.addEventListener("blur",function(){const r=parseInt(o.value);!isNaN(r)&&r>=d.min&&r<=d.max&&(d.value=r,s.innerText=i(r),c()),o.style.display="none",s.style.display="inline"}),o.addEventListener("keydown",function(r){(r.key==="Enter"||r.key==="Tab"||r.key==="Escape")&&(r.preventDefault(),o.blur())}),d.addEventListener("input",function(r){s.innerText=i(parseInt(r.target.value)),c()})}function P(t){const n=Chart.helpers.getRelativePosition(t,l),a=l.scales.x.getValueForPixel(n.x),i=l.scales.y.getValueForPixel(n.y),o=l.data.datasets[0];t.shiftKey?o.data.length>0&&(o.data.pop(),c()):a>l.scales.x.min&&al.scales.y.min&&it);u("itemSizeDsp","itemSizeInp","itemSizeB",t=>t<1024?`${t} B`:`${Math.floor(t/1024)} KB`);u("storageDsp","storageInp","storageGB",t=>t>=1024?(t/1024).toFixed(2)+" TB":t+" GB");u("regionsDsp","regionsInp","regions",t=>t);u("daxNodesDsp","daxNodesInp","daxNodes",t=>t);document.getElementById("chart").onclick=function(t){P(t)};document.getElementById("chart").onclick=function(t){P(t)};document.querySelector('input[name="pricing"][value="demand"]').addEventListener("change",t=>{const n=document.getElementById("demandParams"),a=document.getElementById("provisionedParams");t.target.checked&&(n.style.display="block",a.style.display="none",l.data.datasets[1].hidden=!1,l.data.datasets[2].hidden=!0,c())});document.querySelector('input[name="pricing"][value="provisioned"]').addEventListener("change",t=>{const n=document.getElementById("demandParams"),a=document.getElementById("provisionedParams");t.target.checked&&(n.style.display="none",a.style.display="block",l.data.datasets[1].hidden=!0,l.data.datasets[2].hidden=!1,c())});document.getElementById("tableClass").addEventListener("change",t=>{e.tableClass=t.target.value,c()});document.getElementById("demand").addEventListener("input",t=>{e.demand=parseInt(t.target.value),document.getElementById("demandDsp").innerText=m(e.demand),c()});document.getElementById("ratio").addEventListener("input",t=>{e.ratio=parseInt(t.target.value);const n=e.ratio,a=100-n;document.getElementById("ratioDsp").innerText=`${n}/${a}`,c()});document.getElementById("baseline").addEventListener("input",t=>{e.baseline=parseInt(t.target.value),document.getElementById("baselineDsp").innerText=m(e.baseline),c()});document.getElementById("peakWidth").addEventListener("input",t=>{e.peakWidth=Math.max(1,parseInt(t.target.value)),document.getElementById("peakWidthDsp").innerText=e.peakWidth,c()});document.getElementById("peak").addEventListener("input",t=>{e.peak=parseInt(t.target.value),document.getElementById("peakDsp").innerText=m(e.peak),c()});document.getElementById("ratio").addEventListener("input",t=>{const n=parseInt(t.target.value),a=100-n;document.getElementById("ratioDsp").innerText=`${n}/${a}`,c()});document.getElementById("reservedCapacity").addEventListener("input",t=>{e.reservedCapacity=parseInt(t.target.value),document.getElementById("reservedCapacityDsp").innerText=`${m(e.reservedCapacity)}%`,c()});document.getElementById("storageGB").addEventListener("input",t=>{const n=parseInt(t.target.value);document.getElementById("storageDsp").innerText=n>=1024?(n/1024).toFixed(2)+" TB":n+" GB",c()});document.getElementById("storageDsp").innerText=document.getElementById("storageGB").value;f("tableLink","tableParams","▲ Tables","▼ Tables");f("storageLink","storageParams","▲ Storage","▼ Storage");f("consistencyLink","consistencyParams","▲ Consistency","▼ Consistency");f("daxLink","daxParams","▲ Accelerator (DAX)","▼ Accelerator (DAX)");document.getElementById("itemSizeB").addEventListener("input",function(t){const n=t.target,a=parseInt(n.value);a<=1024?n.step=64:n.step=1024;let i;a<1024?i=`${a} B`:i=`${Math.floor(a/1024)} KB`,document.getElementById("itemSizeDsp").innerText=i,c()});document.getElementById("writeTrans").addEventListener("input",t=>{const n=parseInt(t.target.value);document.getElementById("writeConsistencyDsp").innerText=n===0?"Non Transactional":n===100?"Transactional":`${n}% Transactional (${100-n}% Non Transactional)`,c()});const p=document.getElementById("readConst"),y=document.getElementById("readTrans"),B=document.getElementById("readConstDsp");function E(){const t=parseInt(p.value);let n=parseInt(y.value),a=100-t-n;t===100?B.innerText="Strongly Consistent":a===100?B.innerText="Eventually Consistent":B.innerText=`Strongly Consistent: ${t}%, Eventually Consistent: ${a}%, Transactional: ${n}%`,c()}p.addEventListener("input",()=>{parseInt(p.value)>100-parseInt(y.value)&&(y.value=100-p.value),E()});y.addEventListener("input",()=>{100-parseInt(y.value){e.daxInstanceClass=t.target.value,c()});V();e.pricing==="demand"?(document.querySelector('input[name="pricing"][value="demand"]').checked=!0,document.getElementById("demandParams").style.display="block",document.getElementById("provisionedParams").style.display="none",l.data.datasets[1].hidden=!1,l.data.datasets[2].hidden=!0):e.pricing==="provisioned"&&(document.querySelector('input[name="pricing"][value="provisioned"]').checked=!0,document.getElementById("demandParams").style.display="none",document.getElementById("provisionedParams").style.display="block",l.data.datasets[1].hidden=!0,l.data.datasets[2].hidden=!1);document.getElementById("demand").value=e.demand;document.getElementById("baseline").value=e.baseline;document.getElementById("peak").value=e.peak;document.getElementById("peakWidth").value=e.peakWidth;document.getElementById("itemSizeB").value=e.itemSizeB;document.getElementById("storageGB").value=e.storageGB;document.getElementById("ratio").value=e.ratio;document.getElementById("regions").value=e.regions;document.getElementById("daxNodes").value=e.daxNodes;document.getElementById("demandDsp").innerText=m(e.demand);document.getElementById("baselineDsp").innerText=m(e.baseline);document.getElementById("peakDsp").innerText=m(e.peak);document.getElementById("peakWidthDsp").innerText=e.peakWidth;document.getElementById("itemSizeDsp").innerText=e.itemSizeB<1024?`${e.itemSizeB} B`:`${Math.floor(e.itemSizeB/1024)} KB`;document.getElementById("storageDsp").innerText=e.storageGB>=1024?(e.storageGB/1024).toFixed(2)+" TB":e.storageGB+" GB";document.getElementById("ratioDsp").innerText=`${e.ratio}/${100-e.ratio}`;document.getElementById("regionsDsp").innerText=e.regions;document.getElementById("daxNodesDsp").innerText=e.daxNodes;c(); diff --git a/dist/assets/index-CjpezalN.js b/dist/assets/index-CjpezalN.js new file mode 100644 index 0000000..efd143f --- /dev/null +++ b/dist/assets/index-CjpezalN.js @@ -0,0 +1 @@ +(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const d of o.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function a(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=a(s);fetch(s.href,o)}})();const e={pricing:"demand",demand:1e4,baseline:1e4,peak:1e5,peakWidth:1,hoursPerMonth:730,itemSizeB:1024,storageGB:512,ratio:50,tableClass:"standard",pricePerRRU:125e-9,pricePerWRU:625e-9,pricePerRRU_IA:155e-9,pricePerWRU_IA:78e-8,pricePerRCU:13e-5,pricePerRRCU:25e-6,pricePerWCU:65e-5,pricePerRWCU:128e-6,pricePerRCU_IA:16e-5,pricePerWCU_IA:81e-5,regions:0,pricePerRWRU:625e-9,pricePerRWRU_IA:78e-8,priceIntraRegPerGB:.02,daxNodes:0,daxInstanceClassCosts:{r5Large:.255,r5XLarge:.509,r52XLarge:1.017,r54XLarge:2.034,r58XLarge:4.069,r512XLarge:6.117,r516XLarge:8.137,r524XLarge:12.234},scyllaPrices:[{family:"i4i",instance:"i4i.xlarge",baseline:78e3,peak:12e4,storage:937,price:3.325},{family:"i3en",instance:"i3en.xlarge",baseline:39e3,peak:6e4,storage:2.44*1024,price:4.378}]};function U(t,n,a,i){for(let s=3;s<1e3;s+=3){const o=3/s*t/n<=.9,d=i/3*s>=a;if(o&&d)return s}return 3}function b(){const t=e.storageGB*.5,n=.2,a=U(t,e.scyllaPrices[0].storage,e.totalOpsSec,e.scyllaPrices[0].baseline),i=U(t,e.scyllaPrices[1].storage,e.totalOpsSec,e.scyllaPrices[1].baseline),s=e.scyllaPrices[0].price,o=e.scyllaPrices[1].price,d=a/3*s*730*(1-n),r=i/3*o*730*(1-n),g=r<=d?r:d,C=r<=d?"i3en":"i4i",I=r<=d?i:a;return{scyllaCost:g,nodeCount:I,family:C}}function T(){e.pricing=document.querySelector('input[name="pricing"]:checked').value}function W(){e.tableClass=document.getElementById("tableClass").value}function S(){e.regions=parseInt(document.getElementById("regions").value)}function w(){e.daxNodes=parseInt(document.getElementById("daxNodes").value),e.daxInstanceClass=document.getElementById("daxInstanceClass").value}function D(){e.storageGB=parseInt(document.getElementById("storageGB").value),e.itemSizeKB=parseInt(document.getElementById("itemSizeB").value)*(1/1024),e.itemSizeKB=e.itemSizeKB>1?Math.floor(e.itemSizeKB):e.itemSizeKB}function $(){e.readStronglyConsistent=parseInt(document.getElementById("readConst").value)/100,e.readEventuallyConsistent=1-e.readStronglyConsistent,e.readTransactional=parseInt(document.getElementById("readTrans").value)/100,e.readNonTransactional=1-e.readTransactional,e.writeTransactional=parseInt(document.getElementById("writeTrans").value)/100,e.writeNonTransactional=1-e.writeTransactional}function M(){e.readRatio=parseInt(document.getElementById("ratio").value)/100,e.writeRatio=1-e.readRatio}function L(){e.demand=parseInt(document.getElementById("demand").value)}function N(){e.peakHours=e.peakWidth*30,e.baselineHours=e.hoursPerMonth-e.peakHours,e.reservedCapacity=parseInt(document.getElementById("reservedCapacity").value)/100}function z(){e.writeRequestUnitsPerItem=Math.ceil(e.itemSizeKB),e.readRequestUnitsPerItem=Math.ceil(e.itemSizeKB/4),e.baselineWCUNonTransactional=e.baseline*e.writeRatio*e.writeNonTransactional*e.writeRequestUnitsPerItem,e.baselineWCUTransactional=e.baseline*e.writeRatio*e.writeTransactional*2*e.writeRequestUnitsPerItem,e.baselineWCUTotal=e.baselineWCUNonTransactional+e.baselineWCUTransactional,e.reservedWCU=e.baselineWCUTotal*e.reservedCapacity,e.reservedWCU=Math.ceil(e.reservedWCU/100)*100,e.provisionedBaselineWCU=e.baselineWCUTotal-e.reservedWCU,e.provisionedBaselineWCU=Math.ceil(Math.max(e.provisionedBaselineWCU,0)),e.provisionedBaselineWCUHours=Math.ceil(e.provisionedBaselineWCU*e.baselineHours),e.peakWCUNonTransactional=e.peak*e.writeRatio*e.writeNonTransactional*e.writeRequestUnitsPerItem,e.peakWCUTransactional=e.peak*e.writeRatio*e.writeTransactional*2*e.writeRequestUnitsPerItem,e.peakWCUTotal=e.peakWCUNonTransactional+e.peakWCUTransactional,e.provisionedPeakWCU=e.peakWCUTotal-e.reservedWCU,e.provisionedPeakWCU=Math.ceil(Math.max(e.provisionedPeakWCU,0)),e.provisionedPeakWCUHours=Math.ceil(e.provisionedPeakWCU*e.peakHours),e.provisionedTotalWCUHours=Math.ceil(e.provisionedBaselineWCUHours+e.provisionedPeakWCUHours),e.dynamoCostProvisionedWCU=e.provisionedTotalWCUHours*(e.tableClass==="standard"?e.pricePerWCU:e.pricePerWCU_IA),e.dynamoCostReplication=e.regions*e.provisionedTotalWCUHours*(e.tableClass==="standard"?e.pricePerRWRU:e.pricePerRWRU_IA),e.dynamoCostReservedWCU=e.reservedWCU*e.pricePerRWCU*e.hoursPerMonth,e.dynamoCostMonthlyWCU=e.dynamoCostProvisionedWCU+e.dynamoCostReservedWCU+e.dynamoCostReplication,e.dynamoCostUpfrontWCU=e.reservedWCU*1.5,e.baselineRCUNonTransactional=e.baseline*e.readRatio*e.readEventuallyConsistent*.5*e.readRequestUnitsPerItem,e.baselineRCUStronglyConsistent=e.baseline*e.readRatio*e.readStronglyConsistent*e.readRequestUnitsPerItem,e.baselineRCUTransactional=e.baseline*e.readRatio*e.readTransactional*2*e.readRequestUnitsPerItem,e.baselineRCUTotal=e.baselineRCUNonTransactional+e.baselineRCUStronglyConsistent+e.baselineRCUTransactional,e.reservedRCU=e.baselineRCUTotal*e.reservedCapacity,e.reservedRCU=Math.ceil(e.reservedRCU/100)*100,e.provisionedBaselineRCU=e.baselineRCUTotal-e.reservedRCU,e.provisionedBaselineRCU=Math.ceil(Math.max(e.provisionedBaselineRCU,0)),e.provisionedBaselineRCUHours=Math.ceil(e.provisionedBaselineRCU*e.baselineHours),e.peakRCUNonTransactional=e.peak*e.readRatio*e.readEventuallyConsistent*.5*e.readRequestUnitsPerItem,e.peakRCUStronglyConsistent=e.peak*e.readRatio*e.readStronglyConsistent*e.readRequestUnitsPerItem,e.peakRCUTransactional=e.peak*e.readRatio*e.readTransactional*2*e.readRequestUnitsPerItem,e.peakRCUTotal=e.peakRCUNonTransactional+e.peakRCUStronglyConsistent+e.peakRCUTransactional,e.provisionedPeakRCU=e.peakRCUTotal-e.reservedRCU,e.provisionedPeakRCU=Math.ceil(Math.max(e.provisionedPeakRCU,0)),e.provisionedPeakRCUHours=Math.ceil(e.provisionedPeakRCU*e.peakHours),e.provisionedTotalRCUHours=Math.ceil(e.provisionedBaselineRCUHours+e.provisionedPeakRCUHours),e.dynamoCostProvisionedRCU=e.provisionedTotalRCUHours*(e.tableClass==="standard"?e.pricePerRCU:e.pricePerRCU_IA),e.dynamoCostReservedRCU=e.reservedRCU*e.pricePerRRCU*e.hoursPerMonth,e.dynamoCostMonthlyRCU=e.dynamoCostProvisionedRCU+e.dynamoCostReservedRCU,e.dynamoCostUpfrontRCU=e.reservedRCU*.3,e.dynamoCostProvisionedMonthly=e.dynamoCostMonthlyWCU+e.dynamoCostMonthlyRCU,e.dynamoCostProvisionedUpfront=e.dynamoCostUpfrontWCU+e.dynamoCostUpfrontRCU,e.dynamoCostProvisioned=e.dynamoCostProvisionedMonthly+e.dynamoCostProvisionedUpfront/12}function q(){e.readRequestUnitsPerItem=Math.ceil(e.itemSizeKB/4),e.writeRequestUnitsPerItem=Math.ceil(e.itemSizeKB),e.numberReads=e.demand*e.readRatio*3600*e.hoursPerMonth,e.readRequestUnits=e.numberReads*e.readEventuallyConsistent*.5*e.readRequestUnitsPerItem+e.numberReads*e.readStronglyConsistent*e.readRequestUnitsPerItem+e.numberReads*e.readTransactional*2*e.readRequestUnitsPerItem,e.dynamoCostDemandReads=e.readRequestUnits*(e.tableClass==="standard"?e.pricePerRRU:e.pricePerRRU_IA),e.numberWrites=e.demand*e.writeRatio*3600*e.hoursPerMonth,e.writeRequestUnits=e.numberWrites*e.writeNonTransactional*e.writeRequestUnitsPerItem+e.numberWrites*e.writeTransactional*2*e.writeRequestUnitsPerItem,e.dynamoCostDemandWrites=e.writeRequestUnits*(e.tableClass==="standard"?e.pricePerWRU:e.pricePerWRU_IA),e.dynamoCostReplication=e.regions*e.writeRequestUnits*(e.tableClass==="standard"?e.pricePerRWRU:e.pricePerRWRU_IA),e.dynamoCostDemand=e.dynamoCostDemandReads+e.dynamoCostDemandWrites+e.dynamoCostReplication}function F(){e.totalReadsKB=e.readsOpsSec*3600*e.hoursPerMonth*e.itemSizeKB,e.totalWritesKB=e.writesOpsSec*3600*e.hoursPerMonth*e.itemSizeKB,e.totalReplicatedWritesGB=e.regions*e.totalWritesKB/1024/1024,e.dynamoCostNetwork=e.totalReplicatedWritesGB*e.priceIntraRegPerGB}function G(){e.daxInstanceClassCost=e.daxInstanceClassCosts[e.daxInstanceClass],e.dynamoDaxCost=e.daxNodes*e.hoursPerMonth*e.daxInstanceClassCost}function K(){e.dynamoCostStorage=e.storageGB*.25}function H(){e.readsOpsSec=e.pricing==="demand"?e.demand*e.readRatio:e.baseline*e.readRatio,e.writesOpsSec=e.pricing==="demand"?e.demand*e.writeRatio:e.baseline*e.writeRatio,e.totalOpsSec=e.readsOpsSec+e.writesOpsSec}function O(t,n){let a=[`itemSizeKB: ${e.itemSizeKB} KB`,`storageGB: ${e.storageGB} GB`,`totalOpsSec: ${e.totalOpsSec.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}`];e.pricing==="demand"?a=a.concat([`dynamoCostDemandReads: $${e.dynamoCostDemandReads.toFixed(2)}`,`dynamoCostDemandWrites: $${e.dynamoCostDemandWrites.toFixed(2)}`,`dynamoCostDemand: $${e.dynamoCostDemand.toFixed(2)}`]):a=a.concat([`dynamoCostMonthlyWCU: $${e.dynamoCostMonthlyWCU.toFixed(2)}`,`dynamoCostUpfrontWCU: $${e.dynamoCostUpfrontWCU.toFixed(2)}`,`dynamoCostMonthlyRCU: $${e.dynamoCostMonthlyRCU.toFixed(2)}`,`dynamoCostUpfrontRCU: $${e.dynamoCostUpfrontRCU.toFixed(2)}`]),a=a.concat([`dynamoCostNetwork: $${e.dynamoCostNetwork.toFixed(2)}`,`dynamoCostReplication: $${e.dynamoCostReplication.toFixed(2)}`,`dynamoDaxCost: $${e.dynamoDaxCost.toFixed(2)}`,`dynamoCostStorage: $${e.dynamoCostStorage.toFixed(2)}`,`dynamoCostTotal: $${e.dynamoCostTotal.toFixed(2)}`,`scyllaCost: $${t.scyllaCost.toFixed(2)}`,`costRatio: ${n}`,`nodeCount: ${t.nodeCount}`,`family: ${t.family}`]),console.log("config",e),Q(a)}function A(){const t=l.data.datasets[0].data,n=l.data.datasets[1].hidden?2:1,a=l.data.datasets[n].data;let i=0,s=0;for(let r=1;r=1e9?(t/1e9).toFixed(0)+"B":t>=1e6?(t/1e6).toFixed(0)+"M":t>=1e3?(t/1e3).toFixed(0)+"K":t>=1?t.toFixed(0):t.toString()}function V(){const t=new URLSearchParams(window.location.search);t.get("workload")&&(e.workload=t.get("workload")),t.get("demand")&&(e.demand=parseInt(t.get("demand"))),t.get("baseline")&&(e.baseline=parseInt(t.get("baseline"))),t.get("peak")&&(e.peak=parseInt(t.get("peak"))),t.get("peakWidth")&&(e.peakWidth=parseInt(t.get("peakWidth"))),t.get("storageGB")&&(e.storageGB=parseInt(t.get("storageGB"))),t.get("itemSizeB")&&(e.itemSizeB=parseInt(t.get("itemSizeB"))),t.get("ratio")&&(e.ratio=parseInt(t.get("ratio"))),t.get("pricing")&&(e.pricing=t.get("pricing")),t.get("regions")&&(e.regions=parseInt(t.get("regions"))),t.get("daxNodes")&&(e.daxNodes=parseInt(t.get("daxNodes")))}let x;function X(){clearTimeout(x),x=setTimeout(()=>{const t=new URLSearchParams(window.location.search);t.set("pricing",e.pricing),t.set("storageGB",e.storageGB),t.set("itemSizeB",e.itemSizeB),t.set("tableClass",e.tableClass),t.set("ratio",e.ratio),e.pricing==="demand"?(t.delete("baseline"),t.delete("peak"),t.delete("peakWidth"),t.set("demand",e.demand)):(t.delete("demand"),t.set("baseline",e.baseline),t.set("peak",e.peak),t.set("peakWidth",e.peakWidth)),e.daxNodes===0?(t.delete("daxNodes"),t.delete("daxInstanceClass")):(t.set("daxNodes",e.daxNodes),t.set("daxInstanceClass",e.daxInstanceClass)),e.regions===0?t.delete("regions"):t.set("regions",e.regions),window.history.replaceState({},"",`${window.location.pathname}?${t}`)},1e3)}function c(){X(),J(),A(),_()}function Q(t){const n=document.getElementById("costSavedTip");n.style.display="block",n.innerHTML=t.map(a=>{const[i,s]=a.split(": ");return`
${i}:${s}
`}).join("")}const j=document.getElementById("chart").getContext("2d");function h(t,n,a){const i=[],s=Math.floor((24-a)/2),o=s+a;for(let d=0;d<=24;d++)d>=s&&d({x:n,y:e.demand}))}function Y(t){switch(t){case"twiceDaily":return[{x:0,y:5e3},{x:6,y:1e4},{x:8,y:1e5},{x:10,y:1e4},{x:12,y:5e3},{x:16,y:1e4},{x:18,y:1e5},{x:20,y:1e4},{x:24,y:5e3}];case"constant":return Array.from({length:25},(n,a)=>({x:a,y:5e4}));case"morningPeak":default:return[]}}function J(){l.data.datasets[1].data=k(),l.data.datasets[2].data=h(e.baseline,e.peak,e.peakWidth),l.update()}const l=new Chart(j,{type:"scatter",data:{datasets:[{label:"Workload",borderColor:"#0F1040",backgroundColor:"rgba(170,170,170,0.5)",data:Y(e.workload),fill:!0,showLine:!0,borderDash:[4,4],tension:.3},{label:"On Demand",data:k(),borderColor:"#0F1040",backgroundColor:"rgba(15,16,64,0.8)",showLine:!0,pointRadius:0,fill:!0,tension:.1},{label:"Provisioned",data:h(),borderColor:"#0F1040",backgroundColor:"rgba(15,16,64,0.8)",fill:!0,tension:.1,showLine:!0,pointRadius:0,hidden:!0}]},options:{plugins:{legend:{display:!1},title:{display:!1},tooltip:{callbacks:{label:function(t){return"Workload: "+m(t.raw.y)+" ops/sec"}}},dragData:{round:1,showTooltip:!0,onDrag:function(t,n,a,i){i.x=Math.round(i.x),i.y=Math.round(i.y/1e3)*1e3},onDragEnd:function(t,n,a,i){l.update(),c()},dragX:!0,dragY:!0}},scales:{x:{min:0,max:24,title:{display:!1},ticks:{stepSize:1,callback:function(t){return t.toString().padStart(2,"0")+":00"}}},y:{type:"logarithmic",title:{display:!0,text:"op/sec"},min:1e3,max:1e7,ticks:{callback:function(t){return t===1e3?"1K":t===1e4?"10K":t===1e5?"100K":t===1e6?"1M":t===1e7?"10M":null}}}}}});function u(t,n,a,i){const s=document.getElementById(t),o=document.getElementById(n),d=document.getElementById(a);s.addEventListener("click",function(r){r.stopPropagation(),o.value=parseInt(d.value),s.style.display="none",o.style.display="inline",setTimeout(()=>o.focus(),0)}),o.addEventListener("blur",function(){const r=parseInt(o.value);!isNaN(r)&&r>=d.min&&r<=d.max&&(d.value=r,s.innerText=i(r),c()),o.style.display="none",s.style.display="inline"}),o.addEventListener("keydown",function(r){(r.key==="Enter"||r.key==="Tab"||r.key==="Escape")&&(r.preventDefault(),o.blur())}),d.addEventListener("input",function(r){s.innerText=i(parseInt(r.target.value)),c()})}function P(t){const n=Chart.helpers.getRelativePosition(t,l),a=l.scales.x.getValueForPixel(n.x),i=l.scales.y.getValueForPixel(n.y),o=l.data.datasets[0];t.shiftKey?o.data.length>0&&(o.data.pop(),c()):a>l.scales.x.min&&al.scales.y.min&&it);u("itemSizeDsp","itemSizeInp","itemSizeB",t=>t<1024?`${t} B`:`${Math.floor(t/1024)} KB`);u("storageDsp","storageInp","storageGB",t=>t>=1024?(t/1024).toFixed(2)+" TB":t+" GB");u("regionsDsp","regionsInp","regions",t=>t);u("daxNodesDsp","daxNodesInp","daxNodes",t=>t);document.getElementById("chart").onclick=function(t){P(t)};document.getElementById("chart").onclick=function(t){P(t)};document.querySelector('input[name="pricing"][value="demand"]').addEventListener("change",t=>{const n=document.getElementById("demandParams"),a=document.getElementById("provisionedParams");t.target.checked&&(n.style.display="block",a.style.display="none",l.data.datasets[1].hidden=!1,l.data.datasets[2].hidden=!0,c())});document.querySelector('input[name="pricing"][value="provisioned"]').addEventListener("change",t=>{const n=document.getElementById("demandParams"),a=document.getElementById("provisionedParams");t.target.checked&&(n.style.display="none",a.style.display="block",l.data.datasets[1].hidden=!0,l.data.datasets[2].hidden=!1,c())});document.getElementById("tableClass").addEventListener("change",t=>{e.tableClass=t.target.value,c()});document.getElementById("demand").addEventListener("input",t=>{e.demand=parseInt(t.target.value),document.getElementById("demandDsp").innerText=m(e.demand),c()});document.getElementById("ratio").addEventListener("input",t=>{e.ratio=parseInt(t.target.value);const n=e.ratio,a=100-n;document.getElementById("ratioDsp").innerText=`${n}/${a}`,c()});document.getElementById("baseline").addEventListener("input",t=>{e.baseline=parseInt(t.target.value),document.getElementById("baselineDsp").innerText=m(e.baseline),c()});document.getElementById("peakWidth").addEventListener("input",t=>{e.peakWidth=Math.max(1,parseInt(t.target.value)),document.getElementById("peakWidthDsp").innerText=e.peakWidth,c()});document.getElementById("peak").addEventListener("input",t=>{e.peak=parseInt(t.target.value),document.getElementById("peakDsp").innerText=m(e.peak),c()});document.getElementById("ratio").addEventListener("input",t=>{const n=parseInt(t.target.value),a=100-n;document.getElementById("ratioDsp").innerText=`${n}/${a}`,c()});document.getElementById("reservedCapacity").addEventListener("input",t=>{e.reservedCapacity=parseInt(t.target.value),document.getElementById("reservedCapacityDsp").innerText=`${m(e.reservedCapacity)}%`,c()});document.getElementById("storageGB").addEventListener("input",t=>{const n=parseInt(t.target.value);document.getElementById("storageDsp").innerText=n>=1024?(n/1024).toFixed(2)+" TB":n+" GB",c()});document.getElementById("storageDsp").innerText=document.getElementById("storageGB").value;f("tableLink","tableParams","▲ Tables","▼ Tables");f("storageLink","storageParams","▲ Storage","▼ Storage");f("consistencyLink","consistencyParams","▲ Consistency","▼ Consistency");f("daxLink","daxParams","▲ Accelerator (DAX)","▼ Accelerator (DAX)");document.getElementById("itemSizeB").addEventListener("input",function(t){const n=t.target,a=parseInt(n.value);a<=1024?n.step=64:n.step=1024;let i;a<1024?i=`${a} B`:i=`${Math.floor(a/1024)} KB`,document.getElementById("itemSizeDsp").innerText=i,c()});document.getElementById("writeTrans").addEventListener("input",t=>{const n=parseInt(t.target.value);document.getElementById("writeConsistencyDsp").innerText=n===0?"Non Transactional":n===100?"Transactional":`${n}% Transactional (${100-n}% Non Transactional)`,c()});const p=document.getElementById("readConst"),y=document.getElementById("readTrans"),B=document.getElementById("readConstDsp");function E(){const t=parseInt(p.value);let n=parseInt(y.value),a=100-t-n;t===100?B.innerText="Strongly Consistent":a===100?B.innerText="Eventually Consistent":B.innerText=`Strongly Consistent: ${t}%, Eventually Consistent: ${a}%, Transactional: ${n}%`,c()}p.addEventListener("input",()=>{parseInt(p.value)>100-parseInt(y.value)&&(y.value=100-p.value),E()});y.addEventListener("input",()=>{100-parseInt(y.value){e.daxInstanceClass=t.target.value,c()});V();e.pricing==="demand"?(document.querySelector('input[name="pricing"][value="demand"]').checked=!0,document.getElementById("demandParams").style.display="block",document.getElementById("provisionedParams").style.display="none",l.data.datasets[1].hidden=!1,l.data.datasets[2].hidden=!0):e.pricing==="provisioned"&&(document.querySelector('input[name="pricing"][value="provisioned"]').checked=!0,document.getElementById("demandParams").style.display="none",document.getElementById("provisionedParams").style.display="block",l.data.datasets[1].hidden=!0,l.data.datasets[2].hidden=!1);document.getElementById("demand").value=e.demand;document.getElementById("baseline").value=e.baseline;document.getElementById("peak").value=e.peak;document.getElementById("peakWidth").value=e.peakWidth;document.getElementById("itemSizeB").value=e.itemSizeB;document.getElementById("storageGB").value=e.storageGB;document.getElementById("ratio").value=e.ratio;document.getElementById("regions").value=e.regions;document.getElementById("daxNodes").value=e.daxNodes;document.getElementById("demandDsp").innerText=m(e.demand);document.getElementById("baselineDsp").innerText=m(e.baseline);document.getElementById("peakDsp").innerText=m(e.peak);document.getElementById("peakWidthDsp").innerText=e.peakWidth;document.getElementById("itemSizeDsp").innerText=e.itemSizeB<1024?`${e.itemSizeB} B`:`${Math.floor(e.itemSizeB/1024)} KB`;document.getElementById("storageDsp").innerText=e.storageGB>=1024?(e.storageGB/1024).toFixed(2)+" TB":e.storageGB+" GB";document.getElementById("ratioDsp").innerText=`${e.ratio}/${100-e.ratio}`;document.getElementById("regionsDsp").innerText=e.regions;document.getElementById("daxNodesDsp").innerText=e.daxNodes;c(); diff --git a/dist/index.html b/dist/index.html index 734f5cd..a731930 100644 --- a/dist/index.html +++ b/dist/index.html @@ -8,7 +8,7 @@ - + diff --git a/src/calculator.js b/src/calculator.js index 971a591..a4e3a5f 100644 --- a/src/calculator.js +++ b/src/calculator.js @@ -103,7 +103,7 @@ export function calculateProvisionedCosts() { cfg.provisionedTotalWCUHours = Math.ceil(cfg.provisionedBaselineWCUHours + cfg.provisionedPeakWCUHours); cfg.dynamoCostProvisionedWCU = cfg.provisionedTotalWCUHours * (cfg.tableClass === 'standard' ? cfg.pricePerWCU : cfg.pricePerWCU_IA); cfg.dynamoCostReplication = cfg.regions * cfg.provisionedTotalWCUHours * (cfg.tableClass === 'standard' ? cfg.pricePerRWRU : cfg.pricePerRWRU_IA); - cfg.dynamoCostReservedWCU = cfg.reservedWCU * 0.000128 * 730; + cfg.dynamoCostReservedWCU = cfg.reservedWCU * cfg.pricePerRWCU * cfg.hoursPerMonth; cfg.dynamoCostMonthlyWCU = cfg.dynamoCostProvisionedWCU + cfg.dynamoCostReservedWCU + cfg.dynamoCostReplication; cfg.dynamoCostUpfrontWCU = cfg.reservedWCU * 1.50; @@ -125,7 +125,7 @@ export function calculateProvisionedCosts() { cfg.provisionedPeakRCUHours = Math.ceil(cfg.provisionedPeakRCU * cfg.peakHours); cfg.provisionedTotalRCUHours = Math.ceil(cfg.provisionedBaselineRCUHours + cfg.provisionedPeakRCUHours); cfg.dynamoCostProvisionedRCU = cfg.provisionedTotalRCUHours * (cfg.tableClass === 'standard' ? cfg.pricePerRCU : cfg.pricePerRCU_IA); - cfg.dynamoCostReservedRCU = cfg.reservedRCU * 0.000025 * 730; + cfg.dynamoCostReservedRCU = cfg.reservedRCU * cfg.pricePerRRCU * cfg.hoursPerMonth; cfg.dynamoCostMonthlyRCU = cfg.dynamoCostProvisionedRCU + cfg.dynamoCostReservedRCU; cfg.dynamoCostUpfrontRCU = cfg.reservedRCU * 0.3;