Graphs in Jmeter - graph

I need to perform some load test via a jmeter and for this I have created a test plan that is going to be uploading files for some time while there also is a JDBC request selecting amount of not yet processed files.
Could anyone please help me with some advice how to put the resulting values from the JDBC listener into some meaningful graph?
In the graph I would like to have amount of unprocessed files on one axis and on the second one a time stamp from which the result is.
Many thanks.

You can use Sample Variables property, add the next line to user.properties file (lives in "bin" folder of your JMeter installation)
sample_variables=your_variable_from_JDBC_request_with_number_of_files
This way when next time you launch JMeter in command-line non-GUI mode you will see an extra column in the .jtl results file with the values for the number of not processed files for each and every Sample Result.
Going forward you can create a custom chart for the number of not processed files over time, see Generating customs graphs over time chapter for more details. You will need to change at least jmeter.reportgenerator.graph.custom_testGraph.property.set_Sample_Variable_Name property value to match the one you set in the sample_variables and amend chart and axis titles according to your needs

Related

How to keep track of the number of runs of an R script per day

I am currently looking to write a function in R that can keep track of the number of completed runs of an .R file within any particular day. Notice that the runs might be conducted at different time periods of a day. I did some research on this problem and came across this post (To show how many times user has run the script). So far I am unable to build upon the first commenter's code when converting into R (the main obstacle is to replicate the try....except ). However, I need to add the restriction that the count is measured only within a day (exactly from 00:00:00 AM EST to 24:00:00 AM EST).
Can someone please offer some help on how to accomplish this goal?
Either I didn't get the problem, or it seems a rather easy one: create a temporary file (use Sys.Date() to name it) and store the current run number there; at the beginning of your .R file, read the temporary file, increment the number, write the file back.

Best format to store incremental data in regularly using R

I have a database that is used to store transactional records, these records are created and another process picks them up and then removes them. Occasionally this process breaks down and the number of records builds up. I want to setup a (semi) automated way to monitor things, and as my tool set is limited and I have an R shaped hammer, this looks like an R shaped nail problem.
My plan is to write a short R script that will query the database via ODBC, and then write a single record with the datetime, the number of records in the query, and the datetime of the oldest record. I'll then have a separate script that will process the data file and produce some reports.
What's the best way to create my datafile, At the moment my options are
Load a dataframe, add the record and then resave it
Append a row to a text file (i.e. a csv file)
Any alternatives, or a recommendation?
I would be tempted by the second option because from a semantic point of view you don't need the old entries for writing the new ones, so there is no reason to reload all the data each time. It would be more time and resources consuming to do that.

Efficency for reading file names of a directory ASP.NET

How efficient is reading the names of files in a directory in ASP.NET?
Background: I want to update pictures on a webserver automatically and deploy them in advance. E.g. until the 1. April I want to pick 'image1.png'. After the 1. April 'image2.png'. To achieve this I have to map every image name to a date which indicates if this image has to be picked or not.
In order to avoid mapping between file name and date in a seperate file or database the idea is to put a date in the file name. Iterating the directory and parsing the dates make me find my file.
E.g.:
image_2013-01-01.png
image_2013-04-31.png
The second one will be picked from May to eternity if no image with a later date will be dropped.
So I wonder how this solution impacts the speed of a website assuming <20 files.
If you are using something like Directory.GetFiles, that is one call to the OS.
This will access the disk to get the listing.
For less that 20 files this will be very quick. However since this data is unlikely to change very often, consider caching the name of your image.
You could store it in the application context to share it among all users of your site.

How to save jmeter Summary Report and other graphs (eg. Response Time Graph ) automatically

Each time when I run Jmeter script I have to save the summary report and graphs manually.
I want them to be stored automatically.
I tried to write the Summary results to file as C:\JMeter\Summary${__time(ddMMyy HHmmss)}.csv.
But it comes out in XML format. I want in table format.
When I try to save the response graph as following C:\JMeter\ResponseGraph${__time(ddMMyy HHmmss)}.tif.
The graph is not stored. It comes out as invalid image.
Also, please tell me how to analyse the results which I obtain and how should I interpret them If I load test a website.
My website is like log in as a user, search and add products to the basket, process the order, pay for it and view the order which is processed recently.
Look into these answers for details about getting csv results both via GUI and CMD for jmeter's out-of-box components:
How do i get my CSV file?
How to save JMeter Aggregate Report results to a CSV file using command prompt?
To switch between XML/CSV results storage formats for listeners use
either "Configure" dialog of the listener (Sample Result save Configuration: check / uncheck "Save as XML")
or Results file configuration section in jmeter.properties file:
jmeter.save.saveservice.output_format=csv
jmeter.save.saveservice.assertion_results_failure_message=true
jmeter.save.saveservice.default_delimiter=|
You will possibly like this nice set of custom jmeter-plugins - Jmeter Plugins, - especially Graph components and JMeterPluginsCMD Command Line Tool.
Concerning possibility to save generated graphs: I can successfully save created graphs both for Aggregate Graph and Response Time Graph, both in .tif and .png formats (Jmeter v.2.8).
Can assume that you are possibly using your path to store graph as image (C:\JMeter\ResponseGraph${__time(ddMMyy HHmmss)}.tif in question above) in Filename field of Write results to file / Read from file section of Response Time Graph / Aggregate Graph configuration. But this field is for jmeter's results file (.jtl / .csv) write to / read from, not the path to store graph as image.
I'm not sure that you can automatically store generated graphs from this 2 listener (e.g. during test-scenario execution in non-gui mode).
If you need this you can possibly better look into JMeterPluginsCMD Command Line Tool which has option to generate PNG for selected listener (there is example in plugin's usage description).
For log analysis possibilities look into this recent question:
How to analyse Jmeter report?
Add jp#gc - Graphs Generator plugin in your Apache Jmeter. It will create and save chart in user define directory. You must add View Results Tree before it.
enter image description here

One to one correspending to files - in unix - log files

I am writing a Log Unifier program. That is, I have a system that produces logs:
my.log, my.log.1, my.log.2, my.log.3...
I want on each iteration to store the number of lines I've read from a certain file, so that on the next iteration - I can continue reading on from that place.
The problem is that when the files are full, they roll:
The last log is deleted
...
my.log.2 becomes my.log.3
my.log.1 becomes my.log.2
my.log becomes my.log.1
and a new my.log is created
I can ofcourse keep track of them, using inodes - which are almost a one-to-one correspondence to files.
I say "almost", because I fear of the following scenario:
Between two of my iterations - some files are deleted (let's say the logging is very fast), and are then new files are created and some have inodes of files just deleted. The problem is now - that I will mistake these files as old files - and start reading from line 500 (for example) instead of 0.
So I am hoping to find a way to solve this- here are a few directions I thought about - that may help you help me:
Either another 1-to-1 correspondence other than inodes.
An ability to mark a file. I thought about using chmod +x to mark the file as an
existing file, and for new files that don't have these permissions - I will know they are new - but if somebody were to change the permissions manually, that would confuse my program. So if you have any other way to mark.
I thought about creating soft links to a file that are deleted when the file is deleted. That would allow me to know which files got deleted.
Any way to get the "creation date"
Any idea that comes to mind - maybe using timestamps, atime, ctime, mtime in some clever way - all will be good, as long as they will allow me to know which files are new, or any idea creating a one-to-one correspondence to files.
Thank you
I can think of a few alternatives:
Use POSIX extended attributes to store metadata about each log file that your program can use for its operation.
It should be a safe assumption that the contents of old log files are not modified after being archived, i.e. after my.log becomes my.log.1. You could generate a hash for each file (e.g. SHA-256) to uniquely identify it.
All decent log formats embed a timestamp in each entry. You could use the timestamp of the first entry - or even the whole entry itself - in the file for identification purposes. Log files are usually rolled on a periodic basis, which would ensure a different starting timestamp for each file.

Resources