Parsing and combining JSON files on a per-minute basis

I am currently developing a system that utilizes JSON data to display server performance statistics in HTML tables. The back-end generates a JSON file every minute, each of which contains information on 10 different areas of server performance. Therefore, each JSON snapshot will correspond to one row in each table.

The goal is to create tables that show the last 15 minutes of data. These tables will update every minute to include the latest data and remove the oldest, ensuring that we always have the most recent 15 minutes of statistics displayed.

As I am new to working with JSON and best practices, any suggestions on the best approach would be greatly appreciated. In terms of loading the data from these files, there are three possible methods that come to mind:

  1. Implementing a central Javascript Object, named currentDataSet, to load the past 15 minutes' worth of JSON files. This object would hold data from 15 JSON files, each containing data for 10 tables. Every minute, currentDataSet would update by replacing the oldest minute with the newest minute's data. Each table renderer function would then extract data from currentDataSet to generate the table.

  2. Alternatively, enabling each table renderer function to fetch its own data independently. This means each table could parse the 15 JSON files and manage its own dataset. For example, having separate JavaScript Objects like performanceByInstance, htmlStatus, databaseStatus, dynacacheStatistics, etc...

  3. Considering using a database to store the JSON data instead of relying solely on parsing and JavaScript Objects for storage.

  4. Exploring other potential methods that I may not have considered due to my limited experience. :-)

My main concern is the efficiency of loading 15 JSON files simultaneously for rendering. In the future, I aim to enable the system to load archived data from specific date/time points quickly and render it into the tables when selected.

Dojo will be utilized to accomplish this task, as it aligns with the tools used to build the UI dashboard for this project.

Thank you for your help and advice!

Answer №1

In my opinion, option #1 would be the best choice because option #2 does not offer any additional benefits and option #3 may lack scalability depending on your specific situation.

When initially loading the data, I recommend grouping all the data-sets together to reduce reliance on a single point of failure.

To efficiently manage the "timeliness" of the data-sets, store each one as part of an array instead of using non-indexed data types like Object. Sorting objects can be complicated and confusing, whereas arrays provide more intuitive management options.

Answer №2

If you create a separate Dojo "store" for each table, it can simplify the management and ordering of data, especially if there is an ID-like property in each object of the JSON array that can be used as a unique identifier. Check out more information here

[{
    idLikeProp:1,
    //........
},
{
    idLikeProp:2,
    //........
},
//..........
]

By utilizing these stores, it becomes easier for other Dojo components to integrate with them, such as:

dGrid

Learn more about dGrid here

or

gridX

Learn more about gridX here

This approach can streamline the display of table data, with dGrid being noted as a lighter weight option compared to gridX.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Fetch data dynamically with jQuery AJAX

I am working on a jQuery Ajax form submission to a PHP page with the goal of dynamically returning values instead of all at once. For instance, in my jQuery code: jQuery.ajax({ type: "POST", url: "$PathToActions/Accounts.php", dataType: ...

Is it possible to simplify the use of two ng-shows and two dropdowns in AngularJS by utilizing just one dropdown

Is there a way to use a single dropdown that satisfies both conditions? <div ng-show="user == 'admin'"> <div class="col-md-8 col-sm-12 col-xs-12"> <select ng-model="li" > <option ng-repeat="li ...

Creating a JSON object from text using JavaScript is a straightforward process

Looking to generate an object using the provided variable string. var text ='{"Origin":"Hybris","country":"Germany","Email":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfem ...

Using Regular Expressions (or not) in Javascript/Jquery to append <span> around vowels

Seeking guidance as a beginner in the coding world. Currently, my code generates numbers from 1 to 99 and displays text next to the number based on certain conditions. For instance, numbers divisible by 3 are labeled 'Java', those divisible by 5 ...

How can I create an empty array with AngularJS?

Trying to retrieve an array object from a PHP file using AngularJS, the process seems to work but the array content is not showing up in the browser: Here is my PHP file: <?php include_once '../DAO/DAOadmin.php'; $list = DAOadmin::All(); ...

Using Codeigniter to fetch a PHP array in an AJAX success callback

I have implemented a jQuery script to send the value selected from a dropdown menu to my controller. The controller then calls a function in my model to execute a query using this value, and retrieve an array of results from the database. These results are ...

Resetting the positions of images can be done by following these

I'm currently in the process of developing a game and need assistance with implementing a game end function. Can you provide guidance on how to reset all images back to their original positions? ...

Designing a horizontal slide banner with enhanced functionality

I am working on displaying a vertical banner that slides out horizontally from the right side of the screen when the user clicks on the open button/div, and also has the ability to close it. The basic design concept is illustrated in the sample image below ...

Converting JSON to a multidimensional array in Android/Java

As I delve into the creation of my own personal library to streamline common internet-related tasks, I've successfully implemented http GET and POST functions. Now, my focus shifts towards crafting a versatile JSON parsing function. This function will ...

What are the steps to create fixed Angular Material Chips?

I'm currently attempting to achieve a similar look and functionality as demonstrated here: https://material.angularjs.org/1.1.9/demo/chips#static-chips where the chips are static and not selectable, clickable, or hoverable. However, I am utilizing Ang ...

What could be causing the persistent 304 error I keep encountering whenever I try to link my json file to my ajax requests?

Whenever I try to link my json file to the ajax file, my server responds with a 304 error every time I attempt to open my index.html using live server. Everything was working smoothly until I added the episodes.json file. Despite clearing my cache, the i ...

What are some ways to verify the legitimacy of user input?

Is there a way to verify the validity of a user's input, specifically their email address and password, against a database? I want to retrieve the user's credentials from my website and authenticate them using my 'testlog' database. As ...

Encoding a hierarchical sealed class in Kotlin

I'm currently exploring the serialization of a nested sealed class. Here's an example: @Serializable sealed class Base { @SerialName("concrete_property") val concreteProperty: String = "concrete property of base" @ ...

Setting up the page header in Next.js

I integrated some themekit CSS into the head of my Next.js project, but I'm getting a warning in the browser console. What could be causing this issue? Expected server HTML to contain a matching <head> within a <div>. const Layout = ({ ch ...

The `$scope variable fails to update in another controller`

I am currently facing an issue with updating a value on my view. Let me walk you through my code along with a brief explanation of the situation. The code may look messy as I have been experimenting with different combinations lately. The controller in qu ...

step-by-step tracking indicator

I need help figuring out how to change the buttons on my progress bar when users click the next button. Essentially, I want each step of the progress bar to lead to a different page with unique content - like buttons on step 1, text on step 2, and so on. ...

What is the process for extracting JSON values by specifying keys within a nested JSON structure?

I am attempting to extract specific JSON values for particular keys from a JSON structure. I have made the following attempt: var jsonstring; jsonstring = JSON.stringify(myjsonObjectArray); alert(jsonstring);//displaying the JSON structure below jsonstri ...

Requires a minimum of two page refreshes to successfully load

Our website is currently hosted on Firebase. However, there seems to be an issue as we have to refresh the website at least twice in order for it to load when visiting www.website.com. Update: We are unsure of what could be causing this problem. W ...

The error "Cannot set property '0' of undefined" typically occurs when trying to assign a value to an

Within the code snippet below, my goal is to iterate through the contents of an array: features[0]["values_"]["geometry"]["flatCoordinates"] When running the application, all console statements outside the for-loop successfully display data. However, upon ...

What is the best way to implement a seamless left-to-right sliding effect for my side navigation using CSS and Javascript?

I am currently working on creating a CSS and JavaScript side navigation. Below is the code that I have implemented so far: var nav = document.getElementById('nav'); function show(){ nav.style.display = "block"; } .side-nav{ background-color:bl ...