Error performing load testing using jmeter - jmeter

I am trying to perform load testing using JMeter in which I have recorded a script using HTTP script recorder. now I have to perform the same test with multiple users, hence using a .csv file containing the details of 5 users.now when the test script is run after configuring for 5 users and suppose there are 5 HTTP requests.then some of the requests fails showing the error below:-
PDOException in Connector.php line 55:
SQLSTATE[HY000] [1045] Access denied for user 'forge'#'localhost' (using password: NO)
in Connector.php line 55
at PDO->__construct('mysql:host=localhost;port=3306;dbname=forge', 'forge', '', array('0', '2', '0', false, false)) in Connector.php line 55
at Connector->createConnection('mysql:host=localhost;port=3306;dbname=forge', array('driver' => 'mysql', 'host' => 'localhost', 'port' => '3306', 'database' => 'forge', 'username' => 'forge', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'timezone' => '+00:00', 'strict' => false, 'name' => 'mysql'), array('0', '2', '0', false, false)) in MySqlConnector.php line 22
at MySqlConnector->connect(array('driver' => 'mysql', 'host' => 'localhost', 'port' => '3306', 'database' => 'forge', 'username' => 'forge', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'timezone' => '+00:00', 'strict' => false, 'name' => 'mysql')) in ConnectionFactory.php line 60
at ConnectionFactory->createSingleConnection(array('driver' => 'mysql', 'host' => 'localhost', 'port' => '3306', 'database' => 'forge', 'username' => 'forge', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'timezone' => '+00:00', 'strict' => false, 'name' => 'mysql')) in ConnectionFactory.php line 49
at ConnectionFactory->make(array('driver' => 'mysql', 'host' => 'localhost', 'port' => '3306', 'database' => 'forge', 'username' => 'forge', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'timezone' => '+00:00', 'strict' => false, 'name' => 'mysql'), 'mysql') in DatabaseManager.php line 175
at DatabaseManager->makeConnection('mysql') in DatabaseManager.php line 67
at DatabaseManager->connection('mysql') in Model.php line 3224
at Model::resolveConnection(null) in Model.php line 3190
at Model->getConnection() in Model.php line 1870
at Model->newBaseQueryBuilder() in Model.php line 1813
at Model->newQueryWithoutScopes() in Model.php line 1432
at Model->save() in ActivityController.php line 19
at ActivityController::logUserActivity(object(Request), 'visited', array('url' => 'http://localhost/busnet/Source/Main/Services/public/index.php/post', 'method' => 'POST', 'requested_on' => '1508130477.865', 'responded_on' => '1508130477.8878', 'ip_address' => '127.0.0.1', 'status' => '200')) in ActivityMiddleware.php line 52
at ActivityMiddleware->addToActivityLog(object(Request), object(JsonResponse)) in ActivityMiddleware.php line 34
at ActivityMiddleware->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ActivityMiddleware), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AuthMiddleware.php line 74
at AuthMiddleware->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AuthMiddleware), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CorsMiddleware.php line 26
at CorsMiddleware->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CorsMiddleware), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Application.php line 1451
at Application->sendThroughPipeline(array('App\Http\Middleware\CorsMiddleware', 'App\Http\Middleware\AuthMiddleware', 'App\Http\Middleware\ActivityMiddleware'), object(Closure)) in Application.php line 1221
at Application->dispatch(object(Request)) in Application.php line 1161
at Application->run(object(Request)) in index.php line 30
this is my .csv in notepad
test1#gmail.com,test#123,DATE,DESC,null,1,2,test1#gmail.com
test2#gmail.com,test#124,DATE,DESC,null,3,3,test2#gmail.com
test3#gmail.com,test#125,DATE,DESC,null,4,4,test3#gmail.com
test4#gmail.com,test#126,DATE,DESC,null,5,5,test4#gmail.com
test5#gmail.com,test#127,DATE,DESC,null,6,6,test5#gmail.com
and the CSV dataset config is as follows
https://i.imgur.com/zZaIP9M.png
The error appears for different requests for each run ie sometimes the same request send by 4 out of 5 user passes but one fails.
Can anyone please help me out to resolve this?

Just a guess, but could this be due to mysql not being configured to accept concurrent logins? You could test this by putting everything in the Jmeter thread group under a Critical Section controller:
https://jmeter.apache.org/api/org/apache/jmeter/control/CriticalSectionController.html

Related

Unknown "setting_value" function - Openclassify

I installed Openclassify latest version. In the installation, first I got errors from php artisan install, I changed database.php from:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => env('DB_PREFIX', ''),
'strict' => false,
'engine' => env('DB_ENGINE'),
],
into:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'openclassify'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => env('DB_PREFIX', ''),
'strict' => false,
'engine' => env('DB_ENGINE'),
],
Then I ran composer update and I give php artisan install --ready command, I got this error in the command line:
In
2015_02_27_101227_anomaly.module.preferences__create_preferences_fields.php
line 12: Cannot declare class
AnomalyModulePreferencesCreatePreferencesFields, because the name is
already in use
I ran php artisan serve checked in the browser and I got this error in the browser.
ErrorException (E_ERROR) Unknown "setting_value" function.
This is the error I got in browser http://127.0.0.1:8001/installer when I ran php artisan serve command
The Lines show the errors are as follows:
C:\wamp64\www\openclassify\vendor/visiosoft/defaultadmin-theme/resources/views/partials/metadata.twig
<style type="text/css">
{{ asset_inline("theme.css") }}
{{ asset_inline("build.css") }}
{% if setting_value('visiosoft.theme.defaultadmin::dark_mode') %}
/*Dark mode is active*/
{{ asset_inline("visiosoft.theme.defaultadmin::css/dark_mode.css") }}
{% endif %}
</style>
Kindly look into this issue and share your opinion regarding this.

SQLSTATE[HY000] [2002] No such file or directory (SQL: select count(*) as aggregate from `admins` where `email` = hello#gmail.com) error on laravel8

This is my web.php
<?php
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/register',[App\Http\Controllers\AdminController::class, 'ShowRegister']);
Route::post('/register',[App\Http\Controllers\AdminController::class, 'Register'])->name('register');
.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=project
DB_USERNAME=root
DB_PASSWORD=
database.php
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'project'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
when i try to submit form of register it gives me errors as
Illuminate\Database\QueryException SQLSTATE[HY000] [2002] No such file
or directory (SQL: select count(*) as aggregate from admins where
email = hello#gmail.com) http://127.0.0.1:8004/register
I searched about it too and came to solution that adding unix_socket fixed issue but unfortunately it doesnot help me either !!
what can be issue here ? Help me please !!

Laravel multi-tenant app works properly in local but does not work in production/staging

I build a multi-tenant app in laravel, That works properly in local but it does not work on production/staging. Whenever I try to login, it shows an error that : SQLSTATE[42S02]: Base table or view not found: 1146 Table 'tenancy.users' doesn't exist.
I have already run migrations and also try php artisan config:ca.
Package used : composer require "hyn/multi-tenant:5.3.*"
.env :
LIMIT_UUID_LENGTH_32=true
APP_URL_BASE=testdomain
APP_URL=http://${APP_URL_BASE}
DB_CONNECTION=system
TENANCY_HOST=127.0.0.1
TENANCY_PORT=3306
TENANCY_DATABASE=tenancy
TENANCY_USERNAME=root
TENANCY_PASSWORD=
database.php :
'default' => env('DB_CONNECTION', 'tenant'),
....
'system' => [
'driver' => 'mysql',
'host' => env('TENANCY_HOST', '127.0.0.1'),
'port' => env('TENANCY_PORT', '3306'),
'database' => env('TENANCY_DATABASE', 'tenancy'),
'username' => env('TENANCY_USERNAME', 'tenancy'),
'password' => env('TENANCY_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
'tenant' => [
'driver' => 'mysql',
'host' => env('TENANCY_HOST', '127.0.0.1'),
'port' => env('TENANCY_PORT', '3306'),
'database' => env('TENANCY_DATABASE', 'tenancy'),
'username' => env('TENANCY_USERNAME', 'tenancy'),
'password' => env('TENANCY_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
.....
I also built a laraval mts, with laravel 8. It works locally and i have run into a similar issue.
ensure your .htaccess file is correct. Mine runs in cpanel and i found it was being overwritten everytime i updated the repo with master
make sure you have the databases set up. I use phpmyadmin on cpanel so i had to build the databases.
create a database user and give them access rights to the databases.
update .env to use your newly created database user

SQLSTATE[08006] [7] FATAL: database "test-database" does not exist when i try to migrate in laravel

so im trying to use php artisan migrate but i get this error :
SQLSTATE[08006] [7] FATAL: database "test-database" does not exist (SQL: select * from information_schema.tables where table_schema = public and table_name = migrations and table_type = 'BASE TABLE')
the problem is there is no database "test-database"
here is my env:
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=Batman
DB_USERNAME=postgres
DB_PASSWORD=123456
and here is my database.conf
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'Batman'),
'username' => env('DB_USERNAME', 'postgres'),
'password' => env('DB_PASSWORD', '123456'),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',
],
i really dont get it. please help
try pgAdmin, it has a deb package, it should work fine on Ubuntu.

Laravel 5.8 Installation Error In database.php line 58: Undefined class constant 'MYSQL_ATTR_SSL_CA'

When I tried to install Laravel 5.8 it throws Error
In database.php line 58:
Undefined class constant 'MYSQL_ATTR_SSL_CA'
After this I have tried to run the application on server. It works fine sometimes. Sometimes it throws the same error. I couldn't run any commands on Artisan too. Why this happens and How to solve this?
New Laravel releases have this error. Look in config/database.php, you will see something like :
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]),
Secured Applications have an environment file that contains data for specific machine and software configurations like Database name and password, Email and password, value to tell if it's for development or production, etc.
Laravel loads them in constant accessible via global function env().
There is a file .env that contains those special values in Laravel. So open it and at the bottom of Database section, add your certificate path value:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=blog-db
DB_USERNAME=root
DB_PASSWORD=fakepass
MYSQL_ATTR_SSL_CA=relative/or/absolute/path/to/certificate.extension
Or if you're not planning to use SSL certificate for MySQL connection like most of us, then just comment it in config/database.php :
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
//'options' => array_filter([
// PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
//]),
Like it is currently at Laravel/Laravel master : https://github.com/laravel/laravel/blob/master/config/database.php
If you don't have MySQL extension, you should use:
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
in config/database.php instead of
'options' => array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]),
It's now included by default in Laravel 5.8 https://raw.githubusercontent.com/laravel/laravel/master/config/database.php (though it's probably not released yet).
So just update code with this above and you are good to go.

Resources