HackMD
  • Prime
    Prime  Full-text search on all paid plans
    Search anywhere and reach everything in a Workspace with Prime plan.
    Got it
      • Create new note
      • Create a note from template
    • Prime  Full-text search on all paid plans
      Prime  Full-text search on all paid plans
      Search anywhere and reach everything in a Workspace with Prime plan.
      Got it
      • Sharing Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • More (Comment, Invitee)
      • Publishing
        Everyone on the web can find and read all notes of this public team.
        After the note is published, everyone on the web can find and read this note.
        See all published notes on profile page.
      • Commenting Enable
        Disabled Forbidden Owners Signed-in users Everyone
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Invitee
      • No invitee
      • Options
      • Versions and GitHub Sync
      • Transfer ownership
      • Delete this note
      • Template
      • Save as template
      • Insert from template
      • Export
      • Dropbox
      • Google Drive
      • Gist
      • Import
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
      • Download
      • Markdown
      • HTML
      • Raw HTML
    Menu Sharing Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Versions and GitHub Sync Transfer ownership Delete this note
    Export
    Dropbox Google Drive Gist
    Import
    Dropbox Google Drive Gist Clipboard
    Download
    Markdown HTML Raw HTML
    Back
    Sharing
    Sharing Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    More (Comment, Invitee)
    Publishing
    Everyone on the web can find and read all notes of this public team.
    After the note is published, everyone on the web can find and read this note.
    See all published notes on profile page.
    More (Comment, Invitee)
    Commenting Enable
    Disabled Forbidden Owners Signed-in users Everyone
    Permission
    Owners
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Invitee
    No invitee
       owned this note    owned this note      
    Published Linked with GitHub
    Like BookmarkBookmarked
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # What is SpeedUp and ScaleUp in DBMS? ## Speedup Data warehouses carrying several hundred gigabytes of data are now relatively typical due to the steady increase in database sizes. Even several terabytes of data can be stored in some databases, referred to as Very Large Databases (VLDBs). These data warehouses are subjected to sophisticated queries in order to acquire business intelligence and support decision-making. Such inquiries take a very long time to process. You can shorten the total time spent while still delivering the necessary CPU time by running these queries simultaneously. The ratio of the runtime using one processor to the runtime utilising several processors is known as speedup. The following formula is used to compute it. It estimates the performance advantage obtained by employing more than one processor instead of one CPU: Speedup is equal to Time1 / Timen Time1 is the amount of time needed to complete a task with a single processor, whereas Timen is the amount of time needed to complete the same work with m processors. ### Speedup Curve In an ideal scenario, the speedup from parallel processing would correspond to the number of processors being used for each given operation. Alternatively, a 45-degree line is the optimum shape for a speedup curve. [sample image 1 start] ![](https://i.imgur.com/aZqcgtG.png) [sample image 1 end] Because parallelism involves some overhead, the optimal speedup curve is rarely obtained. The degree of speedup you can obtain is significantly influenced by the application's inherent parallelism. The components of some tasks can be processed in parallel with ease. For instance, it is possible to do two huge tables' join in concurrently. However, some tasks cannot be separated. One such instance is a nonpartitioned index scan. The amount of speedup will be minimal or nonexistent if an application has little or no inherent parallelism. Efficiency is calculated as the speedup divided by the total number of processors. In our example, there are four processors, and the speedup is also four. Consequently, the efficiency is 100%, which represents an ideal case. ### Example: [sample image 2 start] ![](https://i.imgur.com/sQER462.png) [sample image 2 end] A CPU requires 3 mins to execute a process [sample image 3 start] ![](https://i.imgur.com/Qn1f8Z1.png) [sample image 3 3nd] ‘n’ CPU requires 1 min to execute a process by dividing into smaller tasks **Types of Speedup** * Linear Speedup * Sub-Linear Speedup ### Linear Speedup If the speedup is N, then the speedup is linear. In other words, the tiny system's elapsed time is N times greater than the large system's elapsed time (N is the number of resources, say CPU). For instance, if a single machine completes a task in 10 seconds, but ten single machines working in parallel complete the same task in 1 second, the speedup is (10/1)=10 (see the equation above), which is equal to N, the size of the larger system. The 10 times more powerful mechanism is what allows for the speedup. ### Sub-Linear speedup If the speedup is less than N, it is sub-linear (which is usual in most of the parallel systems). More insightful discussions: If the Speedup is N, or linear, that means the performance is as anticipated. **Two scenarios are possible if the Speedup is less than N** **Case 1:** If Speedup exceeds N, the system performs better than intended. In this scenario, the Speedup value would be lower than 1. **Case 2:** It is sub-linear if Speedup N. The denominator (huge system elapsed time) in this situation exceeds the elapsed time of a single machine. In this situation, the value would range between 0 and 1, and we would need to set a threshold value such that any value below the threshold would prevent parallel processing from taking place. Redistributing the workload among processors in such a system requires special caution. **Few Techniques To Speed up Your Database** ### Indices By preserving an effective search data structure, indices enable the database to locate pertinent rows more quickly (e.g., a B-Tree). Each table must perform this. An index might be added seldom because it can be computationally intensive and requires the production system. With SQL (MySQL, PostgreSQL), creating an index is simple: ```sql CREATE INDEX random index name ON your table name (col1, col2); ``` The database can be searched more quickly by adding an index, however the `UPDATE`, `INSERT`, and `DELETE` commands take longer to execute unless the "WHERE" clause takes a long time. ### Query Enhancement The database user does query optimization for each query. There are numerous ways to write queries, and some of them may be more effective than others. The n+1 problem and using a loop to submit numerous requests rather than just one to obtain the data fall under a slightly distinct subcategory of the query optimization topic. ### Changes in business and partitioning You want to impress your customers as your firm expands. You attempt to include any minor new features that customers request. This can result in feature creep. This was a problem quite a while ago, according to the UNIX philosophy: Comparably, dividing your online services data into user groups might be acceptable. Maybe dividing them up into areas makes sense? That's what I observed at Secure Code Warrior and AWS. It could be possible to divide it into "Private clients," "Small business clients," and "Large Business clients." Perhaps a portion of the application can function as its own service with a separate database. ### Replication If reads are your issue and a small amount of update time delay is not a major deal, replication is an easy solution. The database is continuously copied to another system during replication. It serves as a failover mechanism and accelerates reads. [sample image 4 start] ![](https://i.imgur.com/odbmGJB.png) [sample image 4 end] One primary server and numerous replication servers—which were earlier known by different names—are the intended configuration. Data updates are handled by the primary server, not the replication servers, which merely mirror the primary server. Other topologies exist, such as a ring or star configuration. ### Horizontal Partitioning If the table were really large, we could store some rows on one machine and others on another. Horizontal partitioning is the concept of dividing the data into rows. ### Vertical Dividing The large database can be split up into smaller sections using columns rather than rows. You may feel worried about this because you were taught in school that normalising a database is a good thing. That we are discussing various stages of database architecture is crucial to keep in mind. The logical design is related to the numerous normal kinds of databases. The physical design is what we focus on right now. Perhaps not all of a row's columns are required by all application components. It may be acceptable to divide them up because of this. Row splitting is another name for vertical partitioning because of this. One thing to keep in mind is that scaling vertically has nothing to do with vertical partitioning! Vertical partitioning may be advantageous if privacy or legal concerns are not involved. Consider your payment card details. Although it would make logical sense to combine that with other data, the majority of the application does not require it. Even better, you could conceal it behind a private microservice and store it in a whole new database ### Sharding: The Next Step in Partitioning You've seen that there are two distinct ways to group the data. To help the database process frequent queries more quickly, it might already make sense to divide the data on the same system. However, it would be wise to use different machines if the database is using all of the CPU or RAM on the current one. A single logical dataset is sharded and distributed across various devices. This has a lot of problems, as you could expect, so you should only use it as a last resort. For instance, in October 2010 a sharding problem caused Foursquare to be unavailable for 11 hours (source). I've been fortunate enough to avoid dealing with sharding thus far that sharding wasn't something I had to deal with. The first obvious problem is that your application must be aware of which shard has the desired data. Consequently, your application logic could be impacted everywhere. ### Clustering of databases Only when I looked at Vitess did I come across this phrase. The concept appears to cover up the problems with sharding by employing replication as a cover technique. ## Scaleup By adding more processors and discs, scaleup is the ability of an application to maintain response time as the size of the workload or the volume of transactions grows. Scaleup is frequently discussed in terms of scalability. Scaleup in database applications can be batch- or transaction-based. Larger batch jobs can be supported with batch scaleup without sacrificing response time. Greater quantities of transactions can be supported with transaction scaleup without sacrificing response time. More processors are added in both scenarios to maintain response time. For instance, a 4-processor system can deliver the same response time with 400 transactions per minute of burden as a single-processor system that supports 100 transactions per minute of duty. ### Ideal Scaleup curve Figure shows an ideal as a curve, or really a flat line. In truth, even if more processors are added, the reaction time eventually increases for increasing transaction volumes. [sample image 5 start] ![](https://i.imgur.com/Ew8Q5Mq.png) [sample image 5 end] The ability to scale up is determined by how much more processing power can be added while still maintaining a constant response time. The formula below is used to determine scaleup: Scaleup = Volumem/Volume1 Volume1 is the volume of transactions carried out in the same period of time using one processor, whereas Volumem is the volume of transactions carried out using m processors. For the prior instance: Scaleup = 400/100. Scaled-up = 4, Using 4 processors, this scaleup of 4 is accomplished. **Types of scaleup** * Liner Scaling up * Sub-linear Scaleup ### Linear scaling up If resources grow proportionally to the magnitude of the problem, scale-up is linear (it is very rare). The preceding equation states that Scaleup = 1 and is linear if the time taken to solve a small system small problem equals the time taken to solve a large system large problem. ### Sub-linear Scaleup The scaleup is sub-linear if the elapsed time for large systems with huge problems is longer than for small systems with minor problems. Additional discussions that are pertinent include: The system performs flawlessly if scaleup is 1, or linear. We must take extra caution when selecting our plan for parallel execution if scaleup is sublinear and the value ranges between 0 and 1. For instance, if the time it takes to solve a small problem is 5 seconds,, and a large system with a large problem took 5 seconds to solve. This exhibits linearity clearly. Therefore, 5/5 = 1. The system performs admirably for different denominator values, particularly low values (not conceivable beyond a limit). However, the scale up value drops below 1, which necessitates significant attention for better task redistribution, for higher values of the denominator, such as 6, 7, 8, and so on. ## Difference between Speedup and Scaleup Scaleup and speedup differ significantly in that speedup is computed by maintaining a fixed problem size, whereas scaleup is determined by increasing the problem size or transaction volume. How much the transaction volume can be enhanced by adding additional processors while yet maintaining a constant response time is how scaleup is measured. [sample image 6 start] ![](https://i.imgur.com/wzHFGXd.png) [sample image 6 end] [sample image 7 start] ![](https://i.imgur.com/0u7SbTg.png) [sample image 7 end]

    Import from clipboard

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lost their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template is not available.


    Upgrade

    All
    • All
    • Team
    No template found.

    Create custom template


    Upgrade

    Delete template

    Do you really want to delete this template?

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Tutorials

    Book Mode Tutorial

    Slide Mode Tutorial

    YAML Metadata

    Contacts

    Facebook

    Twitter

    Feedback

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions

    Versions and GitHub Sync

    Sign in to link this note to GitHub Learn more
    This note is not linked with GitHub Learn more
     
    Add badge Pull Push GitHub Link Settings
    Upgrade now

    Version named by    

    More Less
    • Edit
    • Delete

    Note content is identical to the latest version.
    Compare with
      Choose a version
      No search result
      Version not found

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub

        Please sign in to GitHub and install the HackMD app on your GitHub repo. Learn more

         Sign in to GitHub

        HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Available push count

        Upgrade

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Upgrade

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully