加鹽
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • 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
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
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
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- title: 程研成發 slideOptions: theme: sky transition: fade --- # 程式研究社 ## 成發 --- ## who am I 資管ㄧ 許佳硯(->菜雞一隻:hatching_chick: ) ![](https://i.imgur.com/Qath8vg.jpg) --- # HTTP/3 HyperText Transport Protocol v.3 - HTTP歷史&問題 - HTTP/3-QUIC --- ## HTTP history ---- ### HTTP/1.0 - TCP在每次的請求、回應進行交握 - response後即斷開 Note: 在HTTP/1之前還有HTTP/0.9的存在,但因為只支援GET方法,一次能傳輸的資料有限,且已被廢除,故在這邊不提及 HTTP/1 是現行超文本傳輸協議中最舊的版本,他會在每一次的傳輸中進行交握,內容傳輸完成後即斷開TCP連線 雖然可以保障伺服器的資源,但對於內容豐富的網站傳輸時間就會比較久 再加上TCP的擁塞控制,會讓仔入速度更加的緩慢 ---- ![](https://mdn.mozillademos.org/files/13727/HTTP1_x_Connections.png) Note: 最左邊的那張就是Http1得傳輸情形,client端提出一次request前,都得先進行一次三向交握,server端傳完內容斷線又得建立一次4項的分手訊息,如此一來一往十分的浪費時間,故 我們有沒有辦法能向中間跟右邊的圖一樣 建立一個TCP連線,傳完所有request 甚至是一次傳送多個request呢 ---- ### HTTP/1.1 - Keep-alive TCP connection - HTTP pipelinig ---- ### HTTP/1.1 ![](https://freecontent.manning.com/wp-content/uploads/HTTP-vs-with-Push-HTTP1.gif) Note: Keep-alive TCP connection 允許用戶端重複使用已建立TCP連線、可以減少初始連結的交握次數、減少因多個requests產生的slow start造成的影響 HTTP piplinig 允許多個requests同時送出,而傳輸過程中不需先等待伺服器的回應 一個包含有許多影象的網頁檔案的多個請求和應答可以在一個連線中傳輸,但每個單獨的網頁檔案的請求和應答仍然需要使用各自的連線 HTTP1.1允許requests重複利用已建立的TCP連線,這樣的機制可以減少交握的次數,以及受到TCP慢啟動機制的影響 ---- ### HTTP/1.1 - 雖然TCP可重複利用,但伺服器收到多個requests還是必須排序來傳輸 - FIFO - HTTP的隊頭阻塞問題 Head-of-line blocking Note: 雖然TCP允許重複利用但在伺服器端每一個請求與回覆都還是要逐一個執行 若其中有一個http的處理時間太長,就會使得後面的風包無法被傳出或是處理,這就是所謂的http對頭阻塞問題 為解決這部分的問題,http/2變加入了「資料流」的概念,藉由控制各個封包的優先權,來實現一次傳送多個資料的 ---- ### HTTP/2 ![](https://freecontent.manning.com/wp-content/uploads/HTTP-vs-with-Push-HTTP2.gif) ---- - 資料流stream的概念產生 - 在同個TCP上允許多路復用 multiplexing - 以上解決了傳輸的效率問題 - 還是有tcp 隊頭阻塞的問題 - 一個封包發生錯誤,需等待重傳造成全部的傳輸線路停止 ---- ![](https://ithelp.ithome.com.tw/upload/images/20191007/200893588ZjO4LvSOA.png) ---- | 問題 | HTTP/1 | HTTP/1.1 | HTTP/2 | |:----:|:------:|:--------:|:------:| |TCP single handshake|v|解決|解決| |http 隊頭阻塞|v|v|解決| |TCP隊頭阻塞|v|v|v| |TCP重傳歧異|v|v|v| --- ## HTTP/3 ---- ### QUIC - QUIC == **Q**uick **U**DP **I**nternet **C**onnection ![](https://i.imgur.com/VkzLKvg.png) ---- #### QUIC小檔案 - QUIC不是首字母縮略字,而是本身就是協議名稱 - 由Google團隊於2013年提出 - 以UDP傳輸機制作為基礎,在應用層加入功能 - 在QUIC層實做出原本TCP有但UDP沒有的功能 - 2018年IETF將QUIC定為HTTP/3的傳輸協議標準,並加入TLS1.3的加密技術 Note: Loss Recovery, Congestion Control - 加入多路複用、降低連線交握的延遲、解決重傳歧異和支持 Connection Migration 的功能 ---- ![](https://i.imgur.com/xMaBncy.png =600x) ---- - 連線建立 Connection Establishment - 多路複用 Multiplexing - 封包遺失恢復 Loss Recovery - ~~流量控制 Flow Control~~ - 連線遷徙 Connection Migration Note: 流量控制的部分跟TCP大致相同,在建立stream時就會去設定傳輸時可允許的最大頻寬 ---- ## 連線建立 ![](https://i.imgur.com/AzLcrh4.gif) 在初始的連結交握,就同時進行金鑰的交換 (相較TCP是先進行交握再進行TLS加密) Note: 相較http/2是依序建立TCP交握和TLS的加密cipher交換,Quic會在第一次的RTT就會進行秘藥的交換 ---- ![](https://miro.medium.com/max/700/1*oUWR-E2PqdhWvIyOBFSxVw.png) Note: 詳細的交握過程 最左邊是首次進行交握,中間是0-RTT server config服務端長期的DH供藥 certification chain singnature of server config source address token (下頁是TCP+TLS1.2, TCP+TLS1.3 和Quic的比較) ---- ![](https://i.imgur.com/fgzVVrV.png) ---- ## 多路複用 因為使用的是UDP,UDP會把每一個封包視為相等(就算掉了也不知道),這個方法剛好可以解決TCP自HTTP/1以來一直未解決的隊頭阻塞問題。 --- ## 封包遺失修復 ---- ## 封包遺失修復 - RTT(Round Trip Time):一個連接的往返時間,即數據發送時刻到接收到確認的時刻的差值; - RTO(Retransmission Time Out):重傳超時時間,即從數據發送時刻算起,超過這個時間便執行重傳, RTO協議實現值最小1s ---- ## 封包遺失修復 - 現行 - 發送端在發出的每一個封包上帶有一個標記sequence number,接收端收到封包後會回傳帶有對應編號的ACK封包給發送端,代表封包已被接收 - 若發送端未收到ACK封包(RTO),就會啟動重傳的機制 ---- ## 封包遺失修復 - 重傳歧異問題 - 啟動重傳機制時,發送端發送的封包的sequence number是一樣的!! - 發送端在拿到編號N封包的回傳ACK時,將無法判斷這個帶有編號N的ACK,是接收端收到初始封包還是重傳封包的ACK - 影響TCP擁塞控制演算法對RTT的取樣,並有可能會使RTO被錯誤的放大,拉長之後封包重傳的反應時間 ---- ## 封包遺失修復 - 發送端在傳送封包時,改用**唯一而且嚴格遞增**unique packet number,藉此判斷收到的ACK是來自初始封包或者是重傳封包 - 接收端則是藉由封包內的 Stream ID 和 Stream Offset 的值,辨認封包是屬於哪一個 Stream,再依照每個封包的 Offset 將資料照順序重組。 --- ## Connection Migration - 現行: - 目前TCP連線需要**來源IP、來源port、目標IP、目標port**四個參數來區分收到的TCP是哪一個連線 - 當client從WIFI網路遷移到4G網路時,原本的連線就已失效 ---- - QUIC - 連線的識別方式改為採用一個64bit的獨特ID - 即使新發送封包的來源 IP 位址不同,接收端也可以透過 Connection ID 順利的識別新封包所歸屬的連線。 - 原本正在傳遞中,存有舊 IP 的封包,也一樣也可以透過 Connection ID 來識別,正確的被接收端接收。 --- # Sum up 簡單來說,QUIC可以 - 在一個RTT中,同時達成交握&加密傳輸,若先前有連過伺服,則可直接開始進行資料傳輸 - 在multiplexing中,不會因為單個stream發生錯誤造成全部傳輸終止,解決HOL問題 - 解決重傳歧異問題 - 解決連線遷移需重新交握問題 --- # Sum up - Chrome 和Firefox皆已支援使用QUIC的協議 ![](https://i.imgur.com/rxLTnx5.png) - Uber 有做過[實驗文章](https://eng.uber.com/employing-quic-protocol/),比較有無QUIC的影響 - 理論上,應該會比較快,但有些ISP對UDP的支援不友善,可能會瘋狂丟包,所以載入速度非常的... --- # 本文網址 https://hackmd.io/@yen0224/http3 --- # Resource - https://medium.com/@chester.yw.chu/http-3-%E5%82%B3%E8%BC%B8%E5%8D%94%E8%AD%B0-quic-%E7%B0%A1%E4%BB%8B-5f8806d6c8cd - https://quicwg.org/base-drafts/draft-ietf-quic-http.html - https://blog.cloudflare.com/http3-the-past-present-and-future/ - https://www.research-collection.ethz.ch/bitstream/handle/20.500.11850/129618/QUIC-authors-copy.pdf - https://www.twblogs.net/a/5eff82845352062f754e61a1 - https://freecontent.manning.com/animation-http-1-1-vs-http-2-vs-http-2-with-push/

    Import from clipboard

    Paste your markdown or webpage here...

    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 lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    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 Sign in with Wallet
    Wallet ( )
    Connect another wallet

    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

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    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 and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    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.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        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
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

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

        Syncing

        Push failed

        Push successfully