From d2112758a827ea150109911626d653ac759d9b5a Mon Sep 17 00:00:00 2001 From: Anchel135 Date: Thu, 27 Jun 2024 14:32:57 +0300 Subject: [PATCH 1/3] add al the description for the configurations --- app/settings/Configurations.tsx | 52 ++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/app/settings/Configurations.tsx b/app/settings/Configurations.tsx index d23e0c9..1b07bef 100644 --- a/app/settings/Configurations.tsx +++ b/app/settings/Configurations.tsx @@ -7,72 +7,96 @@ import TableView from "../components/TableView"; const Configs = [ { name: "THREAD_COUNT", - description: "how many queries can be processed in the same time", + description: `The number of threads in FalkorDB’s thread pool. + This is equivalent to the maximum number of queries that can be processed concurrently.`, value: "" }, { name: "CACHE_SIZE", - description: "how many queries can be execute in the same time", + description: `The max number of queries for FalkorDB to cache. + When a new query is encountered and the cache is full, meaning the cache has reached the size of CACHE_SIZE, it will evict the least recently used (LRU) entry.`, value: "" }, { name: "OMP_THREAD_COUNT", - description: "", + description: `The maximum number of threads that OpenMP may use for computation per query. + These threads are used for parallelizing GraphBLAS computations, so may be considered to control concurrency within the execution of individual queries.`, value: "" }, { name: "NODE_CREATION_BUFFER", - description: "", + description: `The node creation buffer is the number of new nodes that can be created without resizing matrices. + For example, when set to 16,384, the matrices will have extra space for 16,384 nodes upon creation. + Whenever the extra space is depleted, the matrices’ size will increase by 16,384. + Reducing this value will reduce memory consumption, but cause performance degradation due to the increased frequency of matrix resizes. + Conversely, increasing it might improve performance for write-heavy workloads but will increase memory consumption. + If the passed argument was not a power of 2, it will be rounded to the next-greatest power of 2 to improve memory alignment.`, value: "" }, { name: "BOLT_PORT", - description: "", + description: `The Bolt port configuration determines the port number on which FalkorDB handles the bolt protocol`, value: "" }, { name: "MAX_QUEUED_QUERIES", - description: "", + description: `Setting the maximum number of queued queries allows the server to reject incoming queries with the error message Max pending queries exceeded. + This reduces the memory overhead of pending queries on an overloaded server and avoids congestion when the server processes its backlog of queries.`, value: "" }, { name: "TIMEOUT", - description: "", + description: `(Deprecated in FalkorDB v2.10 It is recommended to use TIMEOUT_MAX and TIMEOUT_DEFAULT instead) + The TIMEOUT configuration parameter specifies the default maximal execution time for read queries, in milliseconds. + Write queries do not timeout. + When a read query execution time exceeds the maximal execution time, the query is aborted and the query reply is (error) Query timed out. + The TIMEOUT query parameter of the GRAPH.QUERY, GRAPH.RO_QUERY, and GRAPH.PROFILE commands can be used to override this value.`, value: "" }, { name: "TIMEOUT_MAX", - description: "", + description: `(Since RedisGraph v2.10) The TIMEOUT_MAX configuration parameter specifies the maximum execution time for both read and write queries, in milliseconds. + The TIMEOUT query parameter value of the GRAPH.QUERY, GRAPH.RO_QUERY, and GRAPH.PROFILE commands cannot exceed the TIMEOUT_MAX value (the command would abort with a (error) The query TIMEOUT parameter value cannot exceed the TIMEOUT_MAX configuration parameter value reply). + Similarly, the TIMEOUT_DEFAULT configuration parameter cannot exceed the TIMEOUT_MAX value. + When a query execution time exceeds the maximal execution time, the query is aborted and the query reply is (error) Query timed out. + For a write query - any change to the graph is undone (which may take additional time).`, value: "" }, { name: "TIMEOUT_DEFAULT", - description: "", + description: `(Since RedisGraph v2.10) The TIMEOUT_DEFAULT configuration parameter specifies the default maximal execution time for both read and write queries, in milliseconds. + For a given query, this default maximal execution time can be overridden by the TIMEOUT query parameter of the GRAPH.QUERY, GRAPH.RO_QUERY, and GRAPH.PROFILE commands. + However, a query execution time cannot exceed TIMEOUT_MAX.`, value: "" }, { name: "RESULTSET_SIZE", - description: "", + description: `Result set size is a limit on the number of records that should be returned by any query. + This can be a valuable safeguard against incurring a heavy IO load while running queries with unknown results.`, value: "" }, { name: "QUERY_MEM_CAPACITY", - description: "", + description: `Setting the memory capacity of a query allows the server to kill queries that are consuming too much memory and return with the error message Query's mem consumption exceeded capacity. + This helps to avoid scenarios when the server becomes unresponsive due to an unbounded query exhausting system resources. + The configuration argument is the maximum number of bytes that can be allocated by any single query.`, value: "" }, { name: "VKEY_MAX_ENTITY_COUNT", - description: "To lower the time Redis is blocked when replicating large graphs, FalkorDB serializes the graph in a number of virtual keys. One virtual key is created for every N graph entities, where N is the value defined by this configuration.", + description: `To lower the time Redis is blocked when replicating large graphs, FalkorDB serializes the graph in a number of virtual keys. + One virtual key is created for every N graph entities, where N is the value defined by this configuration.`, value: "" }, { name: "CMD_INFO", - description: "An on/off toggle for the GRAPH.INFO command. Disabling this command may increase performance and lower the memory usage and these are the main reasons for it to be disabled", + description: `An on/off toggle for the GRAPH.INFO command. + Disabling this command may increase performance and lower the memory usage and these are the main reasons for it to be disabled`, value: "" }, { name: "MAX_INFO_QUERIES", - description: "A limit for the number of previously executed queries stored in the telemetry stream.", + description: `A limit for the number of previously executed queries stored in the telemetry stream.`, value: "" }, ] From 9901f3664233b5629931f84d07e75e33d6861379 Mon Sep 17 00:00:00 2001 From: Anchel135 Date: Sun, 30 Jun 2024 11:45:42 +0300 Subject: [PATCH 2/3] get the configuration of the db abd display it in the setting page --- app/api/graph/route.ts | 9 +++++++ app/components/TableView.tsx | 6 ++--- app/settings/Configurations.tsx | 45 +++++++++++++++++++++++++++------ app/settings/page.tsx | 8 +++--- app/settings/users/Users.tsx | 4 +-- 5 files changed, 55 insertions(+), 17 deletions(-) diff --git a/app/api/graph/route.ts b/app/api/graph/route.ts index 53bc51d..8690f00 100644 --- a/app/api/graph/route.ts +++ b/app/api/graph/route.ts @@ -5,12 +5,21 @@ import { getClient } from "@/app/api/auth/[...nextauth]/options"; export async function GET(request: NextRequest) { const client = await getClient() + if (client instanceof NextResponse) { return client } + const type = request.nextUrl.searchParams.get("type") + + if (type === "config") { + const config = await client.configGet("*") + return NextResponse.json({ config }, { status: 200 }) + } + try { const result = await client.list() + return NextResponse.json({ result }, { status: 200 }) } catch (err: unknown) { return NextResponse.json({ message: (err as Error).message }, { status: 400 }) diff --git a/app/components/TableView.tsx b/app/components/TableView.tsx index 35f1da1..945847e 100644 --- a/app/components/TableView.tsx +++ b/app/components/TableView.tsx @@ -46,13 +46,13 @@ export default function TableView({ tableHeaders, tableRows, editableCells, onHo } return ( -
+
{ tableHeaders.map((header, index) => ( - 0 && "p-8")}>{header} + 0 && "p-8")}>{Array.isArray(header) ? header[0] : header} )) } @@ -73,7 +73,7 @@ export default function TableView({ tableHeaders, tableRows, editableCells, onHo const isOnHover = onHoverCells.includes(cellIndex) const isHover = hover === index return ( - + { // eslint-disable-next-line no-nested-ternary !isOnHover ? diff --git a/app/settings/Configurations.tsx b/app/settings/Configurations.tsx index 1b07bef..762db7c 100644 --- a/app/settings/Configurations.tsx +++ b/app/settings/Configurations.tsx @@ -1,10 +1,16 @@ "use client"; -import React, { useEffect } from "react"; -import { securedFetch } from "@/lib/utils"; +import React, { useEffect, useState } from "react"; +import { Toast, securedFetch } from "@/lib/utils"; import TableView from "../components/TableView"; -const Configs = [ +type Config = { + name: string, + description: string, + value: string | number +} + +const Configs: Config[] = [ { name: "THREAD_COUNT", description: `The number of threads in FalkorDB’s thread pool. @@ -104,10 +110,33 @@ const Configs = [ // Shows the details of a current database connection export default function Configurations() { - const tableRows = Configs.map((config) => [ - config.name, - config.description, - config.value + const [configs, setConfigs] = useState(Configs) + + useEffect(() => { + const run = async () => { + const result = await securedFetch(`api/graph/?type=config`, { + method: 'GET', + }) + + if (!result.ok) { + Toast(`Failed to fetch configurations value`) + return + } + const newConfigs = (await result.json()).config + setConfigs(Configs.map((config: Config) => { + const c = config + const [,value] = newConfigs.find(([name,]: [string, string | number]) => name === c.name); + c.value = value; + return c + })) + } + run() + }) + + const tableRows = configs.map(({ name, description, value }) => [ + name, + description, + value ]) useEffect(() => { @@ -129,7 +158,7 @@ export default function Configurations() { return (
- +
); } \ No newline at end of file diff --git a/app/settings/page.tsx b/app/settings/page.tsx index 86848a8..60c748f 100644 --- a/app/settings/page.tsx +++ b/app/settings/page.tsx @@ -20,9 +20,9 @@ export default function Settings() { } return ( - <> +
-
+

Settings

-
+
{ getCurrentTab() }
- +
) } \ No newline at end of file diff --git a/app/settings/users/Users.tsx b/app/settings/users/Users.tsx index 24009c2..e855e31 100644 --- a/app/settings/users/Users.tsx +++ b/app/settings/users/Users.tsx @@ -25,7 +25,7 @@ export default function Users() { { setChecked(check === true) @@ -43,7 +43,7 @@ export default function Users() { const tableRows = users.map((user, index) => [ { setUsers(prev => prev.map(currentUser => { From 2ea9a5b3ed618c70dd413c78a72df1c3932e19b5 Mon Sep 17 00:00:00 2001 From: Anchel135 Date: Mon, 1 Jul 2024 11:06:10 +0300 Subject: [PATCH 3/3] fix the css of tables --- app/components/TableView.tsx | 2 +- app/settings/users/Users.tsx | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/components/TableView.tsx b/app/components/TableView.tsx index 945847e..df81478 100644 --- a/app/components/TableView.tsx +++ b/app/components/TableView.tsx @@ -73,7 +73,7 @@ export default function TableView({ tableHeaders, tableRows, editableCells, onHo const isOnHover = onHoverCells.includes(cellIndex) const isHover = hover === index return ( - + { // eslint-disable-next-line no-nested-ternary !isOnHover ? diff --git a/app/settings/users/Users.tsx b/app/settings/users/Users.tsx index e855e31..7167ba4 100644 --- a/app/settings/users/Users.tsx +++ b/app/settings/users/Users.tsx @@ -22,7 +22,7 @@ export default function Users() { const [users, setUsers] = useState([]) const [checked, setChecked] = useState(false) const tableHeaders = [ - , - "USERNAME", - "ROLE", - "" + />, "w-[10%]"], + ["USERNAME", "w-[40%]"], + ["ROLE", "w-[40%]"], + ["", "w-[10%]"] ] const tableRows = users.map((user, index) => [