How MySQL Tuning Improves the Laravel Performance

https://cdn.devdojo.com/posts/images/March2023/how-mysql-tuning-improves-laravel-performance4.jpg?w=1280&w=720

MySQL Configuration tuning is an important component of database management implemented by database professionals and administrators. It aims to configure the database to suit its hardware and workload. But beyond the database management sphere, the usefulness of MySQL Configuration tuning is largely ignored.

We hypothesize that MySQL tuning can significantly affect the performance of web apps. If we can showcase the value of MySQL tuning, we believe that enterprises and organizations may be keen to incorporate this practice on a larger scale.

How to Improve Laravel Application Performance

Improving application performance with tuning is best achieved with a comprehensive approach that addresses the following areas:

  • Server Resources – CPU, Memory, Storage
  • Software Configurations – Linux, Nginx, Php…
  • Database Management System (DBMS) Configurations – MySQL, PostgreSQL
  • Optimize database scheme and change indexes
  • Optimize applications – Code, Queries, Architecture…

Many experienced developers don’t look at database performance tuning as an opportunity to improve the performance of their apps because they know little about this domain. They spend a lot of time optimizing the codebase, but it reaches a point where it no longer brings a valuable result for the time and energy invested. Our research on how MySQL tuning positively affects the performance of popular open-source web applications is aimed at showcasing this fact to developers.

Testing Approach

Our testing procedure for Laravel Aimeos lets us compare the app’s performance before and after configuration using seeded data. By running the test with the default configuration first, we gain valuable control results to compare the tuned configuration against.

We used the following process to prepare and test each application:

  1. Deploy Laravel Aimeos.
  2. Seed database with data.
  3. Prepare test for JMeter.
  4. Run test for 10 minutes – Ran JMeter test using the Blazemeter performance testing platform.
  5. Tune MariaDB configuration – After default configuration testing, our setup remained the same, but MariaDB was tuned for workload, server resources, and database size.
  6. Re-run test – Repeated the JMeter test using Blazemeter for the tuned configuration.

We published JMeter tests, MySQL Status, and MySQL Variables during tests on Github.

What metrics we looked at?

The metrics we looked at during this research are:

  1. Response Time ( Latency ) is the time between sending the request and processing it on the server side to the time the client receives the first byte. It is the important metric that gives you insight into server performance.
  2. Queries per second is a metric that measures how many queries the database server executes per second.
  3. CPU Utilization.

We collected CPU Utilization and Queries per second metrics to compare the workload.

Laravel Aimeos

Aimeos Laravel is a popular e-commerce web app framework for creating online shops, marketplaces, and B2B apps. With Aimeos, users can create API-first eCommerce shops for Laravel that can scale to support over 1 billion items. It’s available in over 30 languages and has over 300,000 installs.

Testing Setup

To test Aimeos, we started the test with ten users, but we had to decrease the number of users because we couldn’t finish the test with the default configuration.

We seeded the database with 500 Mb data.
Our test duration was 10 minutes.

We used:

  • AWS EC2 instance c5.xlarge with installed Debian 11 as the operating system,
  • Apache as a web server,
  • MariaDB 10.5 set to the default configuration with database size 500 MB.

MySQL Configuration

The configuration used for Aimeos Laravel is as follows:

Tuned Configuration for Laravel Aimeos 500Mb

query_cache_type=1
query_cache_size=134217728
query_cache_limit=16777216
query_cache_min_res_unit=4096
thread_cache_size=0
key_buffer_size=8388608
max_allowed_packet=1073741824
sort_buffer_size=2097152
read_rnd_buffer_size=262144
bulk_insert_buffer_size=8388608
myisam_sort_buffer_size=8388608
innodb_buffer_pool_chunk_size=134217728
innodb_buffer_pool_size=805306368
max_heap_table_size=16777216
tmp_table_size=16777216
join_buffer_size=8388608
max_connections=151
table_open_cache=2048
table_definition_cache=1408
innodb_flush_log_at_trx_commit=1
innodb_log_file_size=201326592
innodb_log_buffer_size=16777216
innodb_write_io_threads=4
innodb_read_io_threads=4
innodb_file_per_table=1
innodb_flush_method=O_DIRECT
innodb_thread_concurrency=0
innodb_purge_threads=4
optimizer_search_depth=0
thread_handling=pool-of-threads
thread_pool_size=2

Testing Results

The Aimeos Laravel testing results showcased dramatic performance improvements between the default and tuned configurations.

The optimization of MySQL resulted in a significant improvement in the average server Response Time, which was reduced from 1.4 seconds to under 800 milliseconds.

Response Time ( Latency ) fell by 42% and average CPU utilization by 86%, while Queries per second increased by an incredible 291%, from 12 to 35 queries per second.

The graph of the results is available below:

AIMEO111.jpeg
S_Latency.pngResponse Time (ms), Aimeos Tuned MySQL Configuration vs Default
Aimeos_CPU1.pngCPU Utilization (%), Aimeos Tuned MySQL Configuration vs Default
Aimeos_QPS.pngQueries Per Seconds, Aimeos Tuned MySQL Configuration vs Default

We teamed up with Laravel developers Gevorg Mkrtchyan and Sergey Sinitsa from Initlab company to investigate this line of questioning and are very grateful for their expertise.
Sergey deployed Aimeos, and Gevorg prepared code for seeding the database.

Conclusion

Our testing procedure, using Aimeos Laravel, showed dramatic improvements in Response Time (Latency), CPU Utilization, and Queries per second after configuring the database server configuration.

Responce Time (Latency) dropped between 42%, while CPU Utilization fell 86%. Queries per second increased in Aimeos Laravel 500MB by 291%.

In conclusion, MySQL tuning is an essential aspect of database management that can have a significant impact on the performance of Laravel applications. Poorly performing web applications can lead to increased page load times, slow request handling, and a poor user experience, which can negatively affect SEO and sales. By optimizing the performance of web apps with MySQL tuning, enterprises and organizations can increase sales, pageviews, conversion rates, and SEO rankings.

With this research, we hope to showcase the value of MySQL tuning as a means to improve the performance of Laravel applications and encourage Laravel developers to consider this practice when optimizing the performance of their apps.

Using tools like Releem, databases can be quickly and easily configured for optimal performance, reducing the burden on software development teams.

Laravel News Links

7 List Functions Every Python Programmer Should Know

https://static1.makeuseofimages.com/wordpress/wp-content/uploads/2023/10/checklist.jpg

Key Takeaways

  • The len() function is useful for determining the number of items in a list, saving time and code compared to manual calculation.
  • The append() function adds a new item to the end of a list, allowing for easy modification based on conditions or user input.
  • The extend() function adds multiple items to an existing list at once, simplifying the process of modifying a list with new elements.

Lists form an essential part of data structures and algorithms in Python. They play an important role, and ignoring them in your projects is almost impossible.

Due to the large importance of lists, Python provides some built-in functions to perform common list operations. These functions aim to help developers work faster and easier.

1. The len() Function

Use the len() function to get the number of items inside a list. Here’s an example:

 my_list = [1, 2, 3, "hello", "rice", "code", 1.2]
list_length = len(my_list)
print(list_length)

Without the len() function, you would have to manually calculate length, like in this example which uses a Python for loop:

 my_list = [1, 2, 3, "hello", "rice", "code", 1.2]
count = 0

for i in my_list:
    count += 1

print(count)

From this example, it is obvious that the len() function saves some code. Ensure you use it whenever the need arises.

2. The append() Function

The append() function adds a new item to the end of your list. A good use of this is to add an item to your list after your code fulfills a certain condition. Here’s a simple example:

 my_list = [1, 2, 3, "hello", "rice", "code", 1.2]
question = input("Do you love Python?: ").lower()

if question == "yes":
    my_list.append("Python is the best!!")
else:
    my_list.append("You should try Python")

print(my_list)

This example uses an if statement to add a certain sentence to the initial list based on the user’s input.

The append() function can add only one item at a time to your list. Instead of the append function, you can use an operator instead:

 my_list = [1, 2, 3, "hello", "rice", "code", 1.2]
my_list += ["Python is the best!!"]

Using the addition operator will ultimately be less efficient because it doesn’t modify your initial list. Instead, it creates a new list in memory and adds a new item to it. The append() function modifies your initial list directly.

3. The extend() Function

The extend() function is a built-in function that adds several items to an existing list at once. It takes in the new items as an argument and modifies your existing list with the argument. Here’s how to use the extend() function:

 my_list = [1, 2, 3, "hello", "rice", "code", 1.2]

my_list.extend(["item", "muo", 350])

print(my_list)

The extend() function can only take one argument, so you should add all your items to a list like the code above.

4. The reverse() Function

The reverse function simply rewrites your list in the reverse order. Here’s an example of the reverse function in use:

 my_list = [1, 2, 3, "hello", "rice", "code"]

my_list.reverse()
print(my_list)

To reverse a list without using the reverse() function, you would need to slice your list. Here’s an example:

 my_list = [1, 2, 3, "hello", "rice", "code"]

reversed_list = my_list[::-1]
print(reversed_list)

In the above example, my_list[::-1] creates a reversed copy of the original list. This means you’ll have two lists in memory, which is not the best approach if you simply want to reverse the original list.

5. The insert() Function

The insert() function modifies a list and adds an item to it like the append() function. However, the insert() function allows you to specify the index (position) of your new item in the list. Here’s an example:

 my_list = [1, 2, 3, "hello", "rice", "code"]

my_list.insert(0, "first")
print(my_list)

From the above code, this is the correct syntax to use the insert() function:

 your_list.insert(index, new_list_item)

6. The sort() Function

The sort() function takes a list of a particular data type and rearranges the elements in ascending order. Here’s an example:

 my_list = [1, 2, 10, 30, 3, 2.4]
my_list2 = ['code', 'rice', 'zion', 'hello']

my_list.sort()
my_list2.sort()

print(my_list)
print(my_list2)

If you use the sort() function on a list with different data types, such as strings and numbers, you will get a TypeError.

7. The count() Function

The count() function counts the number of times a specific element occurs in a list and returns the value to you. Here’s how to use it:

 my_list = ['code', 10, 30, 'code', 3, 'code', 'rice', 5]
print(my_list.count('code'))

Performing such an operation without the count() function would require you to write more code. Here’s an example:

 my_list = ['code', 10, 30, 'code', 3, 'code', 'rice', 5]
count_code = 0

for item in my_list:
    if item == 'code':
        count_code += 1

print(count_code)

The len() function will return the total number of elements in a list, while the count() function will return the number of times a specific element occurs in a list.

Using List Functions to Write Better Code

When working with lists in Python, it is important to use the available list functions to write efficient and clean code. They generally save you from writing complex and time-consuming code.

List functions enable you to easily perform common list operations, giving you more time to focus on other parts of your code.

MakeUseOf

SQL Programming Test in 2023

https://www.techbeamers.com/wp-content/uploads/2023/10/SQL-Programming-Test.png

Welcome to this amazing SQL programming test that will help anyone deeply interested in working with databases. This test will not only help you assess your strengths but also find gaps in your SQL programming skills. Ultimately, you’ll get to know which part of the SQL you need to focus on. SQL Programming Test – […]

The post SQL Programming Test in 2023 appeared first on TechBeamers.

Planet MySQL

Make your PHPUnit test runner look like Disk Defragmenter

https://repository-images.githubusercontent.com/692616979/67e6393f-1574-457d-89bc-327aee959e6a

This package generates a satisfying Defrag-style output when running your PHPUnit test suite.

Sample output

MS-DOS 6.x included a defrag utility that honestly was just so satisfying to watch. The 90s were a different time, folks. Disk defragmentation took about an hour and physically rearranged the data on your hard drive so it was more efficient to read off the disk.

Defrag Running in MS-DOS 6.22

Install the package via composer:

composer require benholmen/defrag --dev

Add the following lines to your phpunit.xml file:

<extensions>
    <bootstrap class="BenHolmen\Defrag\Extension"/>
</extensions>

Run PHPUnit as usual:

Of course, this produces the defrag output you’d expect.

Please see CONTRIBUTING for details.

The MIT License (MIT). Please see License File for more information.

Laravel News Links

10 Ways to Get Free AWS Credits

https://blog.finxter.com/wp-content/uploads/2023/10/image-182.png

5/5 – (1 vote)

????‍???? When looking for ways to get free AWS credits to be used on AWS services such as LLM training for your AI SaaS or EC2 instances, I discovered many resources that provide broken or stale links (or worse, harmful links), so I thought providing this list would be helpful for many Finxters.

To obtain free AWS credits, consider the following programs:

  1. AWS Activate: Ideal for startups, AWS Activate provides up to $100,000 in AWS promotional credits to help grow your business. With resources available quickly, it offers a low-cost, easy-to-use infrastructure.
  2. AWS Activate Founders: A part of AWS Activate, this package is for bootstrapped and self-funded startups. It offers credits, resources, and dedicated support to help startups build, test, and deploy on AWS.
  3. AWS Activate Portfolio: Aimed at startups affiliated with an AWS Activate Provider, this package provides up to $100,000 in AWS Activate Credits for AWS services or AWS Activate Business Support credits for technical support.
  4. Publish an Alexa Skill: Developers can earn a $100 AWS promotional credit for each Alexa skill published, aiding in unlocking your skills’ potential.
  5. AWS Webinars & Events: Attend AWS webinars, events, and conferences to earn AWS credits. Proof of attendance is required. Often, you’ll get an email inviting you to an event to gain AWS credits.
  6. AWS Educate: Designed for institutions, educators, and students to learn cloud skills, AWS Educate provides AWS credits for hands-on experience with AWS tech and training.
  7. AWS Cloud Credits for Research: This program evaluates academic research, awarding credits to researchers building cloud-hosted services or migrating research processes to the cloud.
  8. AWS Imagine Grant Program: Open to registered 501(c) nonprofit organizations, this grant provides up to $100,000 in AWS Promotional Credit to those using technology to address critical global issues.
  9. AWS Free Tier: A great option for new users to access AWS products at no cost up to specified limits for one year from account creation.
  10. Customer Surveys: I get an email from AWS asking me to complete a customer survey roughly every quarter. The survey takes 15 minutes to complete, and I’ll get a $100 credit.

If you want to learn the ins and outs of new technologies and polish your Python and OpenAI skill, feel free to check out our email academy by downloading this cheat sheet:

The post 10 Ways to Get Free AWS Credits appeared first on Be on the Right Side of Change.

Be on the Right Side of Change

How to Use Adobe Bridge Without Photoshop or Lightroom

https://static1.makeuseofimages.com/wordpress/wp-content/uploads/2023/05/macbook-pro-16-inch-laptop-apple-m1-max-man-photo-editing-outdoors-featured.jpg

Many people use Adobe Bridge with Photoshop, Camera Raw, and Lightroom. But what happens when you don’t have access to any of those apps, and you still want to perform basic actions?

Although Adobe Bridge’s uses are limited without the major Adobe photo-editing apps, it is possible to still get a lot out of the service. Today, you’ll learn how to use Adobe Bridge without Photoshop or Lightroom.

What Is Adobe Bridge?

Whereas Lightroom and Photoshop are primarily for photo editing (you can even use Photoshop and Lightroom together), Adobe Bridge is mainly used for managing your files and folders.

With Adobe Bridge, you can edit data for your images and preview content that you may later want to edit. On top of that, you also have the option to export your photos to a new file or folder—plus more.

Although Adobe Bridge is part of the Creative Cloud ecosystem, you don’t need a paid subscription to use the app. All you need is to sign up for an Adobe account. We’ve got more of an in-depth guide to what Adobe Bridge is if you’re interested in learning more.

How Can You Use Adobe Bridge Without Photoshop or Lightroom?

Using Adobe Bridge with a photo-editing app will let you get the most out of the tool. But in some limited cases, you can use Bridge without needing Photoshop or Lightroom. In the subsections below, you’ll discover some of the best ways to do that.

1. Access Photos From Your Computer and External Hard Drives

One of the best ways to use Adobe Bridge without Photoshop or Lightroom is to access photos from your computer or other files. You can do this even if you haven’t already uploaded those photos to either photo editor.

Here’s how to view images with Adobe Bridge:

  1. Go to the Folders tab on the left-hand side of your screen.
  2. Navigate to the folders that you want to access. You can pick from either your computer or a connected external hard drive.
  3. Click the left or right arrow keys to look through each of the images within that folder.

If you double-click on a photo, it will open the Photoshop app, so you can only view small previews in Adobe Bridge. If you go to the bottom, you can choose whether you want to see Grid View, List View, or Thumbnail View.

2. View Different File Types

Tying in with the above, you can also view what’s in your files and folders—based on different file types. In the example we’re about to show you, we can choose from each of the following:

  • Camera Raw images
  • DNG files
  • Folders
  • JPEGs

To choose a selection of these, go to the Collections tab and select Filter > File Type.

3. Rate Images

It’s likely that you’ll capture hundreds of shots in one photoshoot outing. And if you’re traveling, you may come back home with thousands of photos to sift through. If you aren’t careful with how you organize your files, you could waste a lot of time editing pictures that you don’t want to.

Knowing how to implement a speedy photo editing workflow will make it much easier to complete projects more effectively. Thankfully, Adobe Bridge has a rating system that will allow you to pick the pictures or designs you want to edit with more simplicity.

The star rating system goes from 1-5. To use it, simply click on the number of stars for which you want to rate your selected image. You can always change this later if you want to, so don’t worry too much about it.

After rating your photos, you can easily sort your folders based on ratings:

  1. Click on the filter with a star icon.
  2. Select how you want to sort your photos.

In addition to viewing which pictures you’ve starred, you can also opt to view rejected content.

Editing photo metadata can save a lot of hassle in some situations. For example, if you take photos for a blog, you may notice that the description shows up as an unwanted caption. If you do happen to own a blog website, you should also ensure you aren’t making these mistakes when taking pictures for your blog.

In addition to descriptions, you can adjust where your picture was taken using the latitude, altitude, and longitude. Moreover, you have the option to alter the date you captured the image.

To edit a photo’s metadata:

  1. Select the image you want to adjust.
  2. Go to Metadata, which you should see in the bottom left-hand corner.
  3. Edit the boxes you can change.

5. Search Adobe Stock

Adobe Stock is a helpful site for royalty-free content, including photos and videos. You can access Stock directly from Adobe Bridge without needing to use Photoshop or Lightroom.

To visit Adobe Stock, navigate to Libraries and select Go to Stock & Marketplace; it’s on the right-hand side. The Creative Cloud app will then open. Here, you can use various free libraries and designs in your projects.

If you need more in-depth content for your video projects, consider checking out this comparison between Adobe Stock and Storyblocks.

6. Export Photos

Even if you use Adobe Bridge without Photoshop or Lightroom, you can export pictures to different locations. To do that:

  1. Right-click on the picture you want to export. If you have a Mac, use control + trackpad instead.
  2. Select Export to > Custom Export.
  3. Expand Save To and select Specific Folder, before selecting Browse.
  4. Choose your new file and click on Start Export.
  5. Hit Close once the file has been exported.

7. Delete Photos

It’s also possible to delete photos in Adobe Bridge:

  1. Select the image(s) you want to remove and hit the backspace key on your computer.
  2. A pop-up window titled Reject or Delete? will appear. Select Delete.

Organize Your Photos in Adobe Bridge Without Photoshop or Lightroom

Adobe Bridge is best used with Photoshop or Lightroom, but you don’t necessarily need to use either of those apps. You can still use Bridge to organize your files and get stricter on which ones you’ll import and edit. Doing so will ensure that you don’t need to repeat the same steps later.

MakeUseOf

Black Beard Fire Plugs

https://theawesomer.com/photos/2023/10/black_beard_fire_plugs_t.jpg

Black Beard Fire Plugs

 | Buy | Link

These flammable, fiber-filled plugs help light campfires and fire pits with ease. They ignite quickly and will burn long enough to get a fire going, even if they get wet. Each bag comes with enough plugs to start 50 fires, and they have a 30-year shelf life, making them great for a survival kit.

The Awesomer

Bolt SQL – Fast and beautiful database client

https://picperf.dev/https://laravelnews.s3.amazonaws.com/featured-images/bolt-sql-featured.jpg

Bolt SQL - Fast and beautiful database client

Bolt SQL is a brand-new database client from the makers of TablePlus.

This new client focuses on speed and more cloud integration so you can more easily share your setup across machines or with your team.

As a die-hard TablePlus user, I was excited to see this beta, and I noticed the speed as soon as I exported and imported data into it. Both felt instant. It’s not 100% feature-complete with TablePlus, but I imagine it’ll be pretty close once they finish the beta. Let’s look at some of the features of this new app.

Differences between TablePlus and Bolt SQL

TablePlus mainly focuses on native experience and fast interaction with GUI. TablePlus runs completely on your machine, and all data is stored within it.

Bolt SQL moves to the cloud, allowing you new features like configuration synching on all users’ devices, real-time collaboration, sharing charts and reports, and even more AI integration coming in the future.

Friendly GUI tool, blazing fast, and tracking-free

Bolt SQL cherry-picked the features you use the mostand made them easy to access. The top priorities are performance, security, and privacy.

Real-time collaboration

Bolt SQL supports real-time collaboration so you and your team can work together!

Shared workspaces

Sync and your data on all devices so you can work everywhere. Bolt SQL uses end-to-end encryption; no one can access it without the private key.

Charting

With Bolt SQL you can generate bar or line charts from your queries to easily visualize your data.

More features coming soon!

The Bolt SQL team is planning on implementing the following in the coming weeks:

  1. Integrating chatGPT and other LLMs to improve the autosuggestions.
  2. Support more charts and a dashboard builder.
  3. Support advanced filters for the table view.
  4. Add table structure/index/foreign key editor.
  5. Support more database drivers like DuckDB, Redis, etc.

Bolt SQL Pricing

You can use Bolt SQL for free on the basic plan, but that doesn’t include any cloud features. If you want to try the beta, they include an early bird coupon in the top bar header of the site for 50% off.

Visit Bolt SQL for more details and try it. It works for MacOS and Windows, and a Linux version coming soon.


The post Bolt SQL – Fast and beautiful database client appeared first on Laravel News.

Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.

Laravel News