Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion src/components/TechNotes/RouterResourceEstimator.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const RouterResourceEstimator = () => {
const [peakRequestRatePerSecond, setPeakRequestRatePerSecond] = useState('');
const [baselineSubgraphLatency, setBaselineSubgraphLatency] = useState('100');
const [clientRequestSize, setClientRequestSize] = useState('0.1');
const [averageQueryPlanFetchNodes, setAverageQueryPlanFetchNodes] = useState('1');
const [clientResponseSize, setClientResponseSize] = useState('0.1');
const [numberOfInstances, setNumberOfInstances] = useState('3');
const [baseMemory, setBaseMemory] = useState('100');
Expand All @@ -42,6 +43,8 @@ const RouterResourceEstimator = () => {
const Ls = parseFloat(baselineSubgraphLatency) / 1000;
const Sreq = parseFloat(clientRequestSize);
const Sres = parseFloat(clientResponseSize);
// If you average more than 2 subgraphs fetches add a multiplier
const Sqp = parseFloat(averageQueryPlanFetchNodes) / 2 + 1;
const I = parseFloat(numberOfInstances);
const Mb = parseFloat(baseMemory);
const Mq = parseFloat(queryPlannerMemory);
Expand All @@ -60,7 +63,7 @@ const RouterResourceEstimator = () => {
// Rate per vcpu, assuming 80% utilization
const Rc = 0.8 / (L - Ls);
// Memory usage per vcpu
const Mc = (Sreq + Sres) * Rc * L;
const Mc = (Sreq * Sqp + Sres) * Rc * L;
// Number of vCPUs needed
const vBaseline = Math.max(Math.round(R / Rc), 1);
// Number of vCPUs needed for peak traffic
Expand Down Expand Up @@ -174,6 +177,30 @@ const RouterResourceEstimator = () => {
</Box>
</Flex>
</FormControl>
// Client Request Query Plan Size
<FormControl>
<Flex w="100%">
<FormLabel flex="1">Average Request Query Plan Size</FormLabel>
<Box flex="1">
<InputGroup size="sm">
<NumberInput
precision={1}
step={1}
min={1}
w="100%"
value={averageQueryPlanFetchNodes}
onChange={value => setAverageQueryPlanFetchNodes(value)}
>
<NumberInputField placeholder={1} />
</NumberInput>
<InputRightAddon children="Fetch nodes" />
</InputGroup>
<FormHelperText>
The average number of fetch nodes (subgraph calls) in your query plans
</FormHelperText>
</Box>
</Flex>
</FormControl>
// Client Response Size
<FormControl>
<Flex w="100%">
Expand Down