Load testing a complex workflow - performance

I want to load test a website. The website is used mainly to submit picture albums and has two main worflows:
One workflow for user registration:
Create a new account
Enter username, password, email address
Agree to the terms
Upload an avatar picture
Another workflow to submit albums:
Login
Create a new album with name, location, etc.
Upload a picture
Tag picture
Repeat from 3 (0 to n times)
Submit
These workflows take quite some time to execute (submitting a new album takes up to 5 minute). If I want to generate 1 album submission per second, I would have 5 * 60 = 300 threads running.
Also there is constraint on the data:
A user cannot have two albums with the same name
A picture cannot be uploaded twice or by two different users
I am wondering how other websites with similar workflows have been load tested and what is the recommended approach.

Test Data is very important for any performance testing, the Test data used could within the application has to be unique or duplicate could work.
In your application it has to be Unique, so I recommend you need to create test data separately for each scenario with the sufficient number of records available to complete each transaction, without any interdependence.
For albums names, you can create the unique name to append the data & time within your script, for example - TData_0605_1205
Similarly, you need to build a good amount of Image repository that can last for 300 * total load test time(mins), the naming convention for these images can be incremental, say TImage1, TImage2, TImage3............TImagen , within your script, write a logic to pick the images in sequential fashion with incremental of 1, this number you can get from the thread count/iteration count depending on how you script your framework.
Hope this helps.
​​Thanks,
Bhaskar
Technical Head
Thought Frameworks Inc
C: +1-619-630-5034

Related

Model-driven PowerApp: Best practice to display subgrid of records with no appropriate primary column name

Background
Each Dataverse table contains a primary name column. When displayed in a subgrid, clicking on the primary name column will navigate to the form so that the user can edit that row. Most subgrids in my application work this way.
The Problem
I have a Course form with a list of participants displayed in a subgrid. The subgrid displays each student's name (as a link) and the grade received in the course. There is no appropriate primary name column for this Participant table. To edit the participant record, the user must select the row in the subgrid, then click the subgrid's Edit button. As a result, this UI is different from all other subgrids in the application and I know that user's will click the student name to try to edit the participant record and be confused when they are presented with the student record.
Am I missing something? Is there a better way to handle this?
It's a common problem I face quite often. Here is usually what I would do.
Make sure the Primary Name Column always contains relevant information to the user to be able to quickly identify a record. Sometimes it requires copying information from one or multiple other columns into the primary column.
In your case that would probably means concatenating the student's name and grade.
How to do that?
Common to all solutions below
Use one of the following solution to copy the content of one or several fields into the primary column.
Make sure the solution you select also updates the content of the primary name column when one of the copied field is updated.
Remove or hide the primary column from the form, the name of the record will be displayed at the top of the form anyway and you probably don't want users to play with it.
Display the primary name column in every subgrid.
I would recommend not adding the fields copied into the primary column in the subgrids to avoid confusion.
Solution 1 - Classic Workflow
Create a classic workflow that runs when a record is created / updated
Pros:
Very quick to put in place
Runs synchronously (users will see the name updated in real-time)
Cons:
Not very practical if you need to add business logic (using different fields as source depending on a certain condition for example)
Solution 2 - Power Automate
Create a Flow that runs when a record is created / updated
Pros:
You can implement complex business logic in your Flow
Cons:
Runs asynchronously (users will have to refresh the page after the creation of a record to see the record's name)
According to Power Automate licensing that flow would certainly be considered as an "enterprise flow" and you are supposed to pay 100$ / month. That specific point must be taken with a grain of salt. I had several discussions with Microsoft about it and they haven't given me a clear answer about what would be considered an enterprise flow.
Solution 3 - Plugin
Create a plugin that executes when a record is created / updated
Pros:
You can implement very complex business logic in your Flow
It can run synchronously
Cons:
Pro-code (I put it as a con since Model-Driven App is a low-code / no-code approach but there is nothing wrong about pro-code per say)
Developing a new plugin for each entity where you need this logic is kind of overkill in my opinion. I would consider developing something very generic that would only require some sort of configuration when the logic needs to be applied to a new table.

Printing several student's data in several pages in laravel

I am working on a Laravel application where I have $students variable with lots of students with their details. A Student's data may need 1 or more pages. I have to print them by one click in several pages with separate pages. How to do this?
There are lots of students, and taking too long to load when trying to print from browser using ctrl+p. Most importantly the next students data in not starting from a new page.

Automated tests with Laravel

I am new to PHP laravel framework.
My application is very basic:
User first log-in with login and password (html form)
The user can add items in a mysql table. This are numeric values. There are 2 controllers: One to see all rows and another to add/edit row
Another Controller computes statistics (sum, average, etc.) on the numeric values stored in the table.
What i want do to is to test this application.
I want to write a test that:
Creates an empty database
Creates a user
Log-in this user on my application
Creates entries in my table throw my application (not directly in mysql)
Check in the listing page if each entry has been created properly
And i want to check if the statistics are good (check good values displayed on the webpage.
I have read about Testing section on Laravel's website documentation.
Here are my questions:
I do not se how i can automated database initialization
I do not see how i can check if a span or div contains a specific value (i only can test http response code and if webpage contains a given string).
I have worked with phpunit.
Thanks a lot

How to allow people to edit multiple posts at the same time without overwriting each one?

I have a site where people can create posts and submit them (like on Stackoverflow and Facebook).
One thing that the user can do is attach a photo before submitting the post. So as soon as the photo is attached (using AJAX), a new PostID is created in the backend database table for the post that's being worked on and stored in the user's SESSION scope e.g. SESSION.LoggedIn.PostID = rsInsertedPost.PostID.
The same things happens even if a photo isn't attached except that it will create the PostID on the final submission of the post instead.
The reason I store it in the SESSION scope is because the PostID that's just been created is used in multiple other areas in the backend application (CFC component in my case). For example, it will insert tags that the user associated with his post into a seperate table dbo.PostTags like such:
PostID | Tag
44 ColdFusion
44 Programming
44 SQL
After it has finished processing the form submission, it will remove the PostID from the user's SESSION.
The problem that I am about to encounter is when a user opens up multiple browser windows and decides to start working on multiple posts at the same time. The SESSION's PostID value will keep being overwritten by the newly created one which means that if they decided to go back to a different browser tab and submit their post it would end up affecting the last created Post.
What would be a good way to overcome this issue of keeping a track of PostIDs that people are currently working on per window. Is there some other unique attribute I could store in the SESSION alongside the PostID so that only that one will be affected per browser window thats open?
I like to use UUIDs. Then I'm sure to never use the same ID twice, not even across database tables.
So instead of setting the PostID to a number (typically 1 + the last id in the database table), use #createUUID()#.

Seed db with a particular record set with associated records

I am building a feature where when a person signs up for an account we will automatically populate their account with default categories and items to get them started.
Further, they can optionally purchase additional category sets to add/populate their accounts at anytime.
I am thinking my choices are:
1) Somehow use seeds.rb
2) Store these records in a YAML file and load in upon account creation
3) Store these records in the DB as a default set and clone/dup them.
Any help appreciated w/ code examples to get me started.
This is what I would do:
Have a flag in the DB to identify first_sign_in Store the data in a yaml file (e.g db/users.yml) and do:
def populate_user
user.update_attributes(YAML.load(Rails.root + 'db/users.yml')) if first_sign_in == 0
end
Then you can add this to an after_create hook so it is called only when a user is created
I'd do it differently. I'd have a "Registration" form object between the controller and model(s). Have this build some default categories and items at the same time as it first builds a user. How you isolate the attributes of those default items depends on how complex they are. If they're simple a default hash in the form object will suffice, if they're complex you can pull in from YML.
When I've done this in the past - had a signup which requires multiple object creation I've had a RegistrationsController, a RegistrationForm object which takes the params and validates everything, and is also responsible for knowing what to save, and sometimes in intermediate Registrar object (Struct usually) which has all the logic for callbacks. The registrations_controller initializes a registrar which is sent a message register(registration_form).
This leads to isolation of responsibilities and much cleaner code in the long run.
The answers provided are definite options, with which I experimented with. However, I decided to go a different route. I realized that I would need to manage these 'template' records and a DB would be easiest.
1) I setup a column on the table 'is_template' to mark the records that will be used to seed other accounts.
2) Created an after_create call back to seed the accounts using these records.
3) To make matters easier I used the amoeba gem which allows me to copy the records and their associated records which works great since some of them have has_many relationships.
This has been working great so far - and I also have a way for myself and the non-tech staff to update the records.

Resources