使用 Graviton Porting Advisor 來遷移到 AWS Graviton

閱讀時間約 23 分鐘

可以分析源代碼並檢查在遷移到 AWS Graviton 時需要更改的過時運行library

優化 aws 成本的方法之一是遷移到並採用具有高性價比的AWS Graviton

推薦使用AWS Graviton,從可持續性的角度來看,它有很好的表現

但有需要注意的地方:

  • 不適用於所有操作系統和實例類型
  • 由於處理器設計和正在運行的應用程序規範,可能無法實現預期性能

特別是有這兩點高度依賴於正在執行的應用程序的要求而不是基礎設施,因此建議在遷移之前進行驗證

因此,在 GitHub 上發布了遷移指南

https://github.com/aws/aws-graviton-getting-started

https://github.com/aws/aws-graviton-getting-started/blob/main/transition-guide.md

在上面的文章中,介紹了Graviton 的 Porting Advisor 作為一種工具來幫助分析和更改工作負載中的軟體


嘗試使用

https://github.com/aws/porting-advisor-for-graviton

目前要分析的語言和檢查對像如下

  • Python 3+
    • Python version
    • PIP version
    • Dependency versions in requirements.txt file
  • Java 8+
    • Java version
    • Dependency versions in pom.xml file
    • JAR scanning for native method calls (requires JAVA to be installed)
  • Go 1.11+
    • Go version
    • Dependency versions on go.mod file
  • C, C++, Fortran
    • Inline assembly with no corresponding aarch64 inline assembly.
    • Assembly source files with no corresponding aarch64 assembly source files.
    • Missing aarch64 architecture detection in autoconf config.guess scripts.
    • Linking against libraries that are not available on the aarch64 architecture.
    • Use of architecture specific intrinsic.
    • Preprocessor errors that trigger when compiling on aarch64.
    • Use of old Visual C++ runtime (Windows specific).
    • The following types of issues are detected, but not reported by default:
      • Compiler specific code guarded by compiler specific pre-defined macros.
    • The following types of cross-compile specific issues are detected, but not reported by default.
      • Architecture detection that depends on the host rather than the target.
      • Use of build artifacts in the build process.

先決條件

  • Python 3.10 or above (with PIP3 and venv module installed).
  • (Optionally) Open JDK 17 (or above) and Maven 3.5 (or above) if you want to scan JAR files for native methods.


確認版本

#  python3 --version
Python 3.10.6


下載檔案

root@ip-10-0-5-161:~# git clone https://github.com/aws/porting-advisor-for-graviton.git
Cloning into 'porting-advisor-for-graviton'...
remote: Enumerating objects: 333, done.
remote: Counting objects: 100% (333/333), done.
remote: Compressing objects: 100% (206/206), done.
remote: Total 333 (delta 102), reused 302 (delta 87), pack-reused 0
Receiving objects: 100% (333/333), 144.62 KiB | 3.71 MiB/s, done.
Resolving deltas: 100% (102/102), done.
root@ip-10-0-5-161:~#
root@ip-10-0-5-161:~# ls
porting-advisor-for-graviton


建立虛擬環境

root@ip-10-0-5-161:~# python3 -m venv .venv
root@ip-10-0-5-161:~#
root@ip-10-0-5-161:~# source .venv/bin/activate
(.venv) root@ip-10-0-5-161:~#


安裝library套件

(.venv) root@ip-10-0-5-161:~# cd porting-advisor-for-graviton
(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton#
(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton# pip3 install -r requirements.txt
Collecting altgraph==0.17.2
Downloading altgraph-0.17.2-py2.py3-none-any.whl (21 kB)
Collecting Jinja2==3.1.2
Downloading Jinja2-3.1.2-py3-none-any.whl (133 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.1/133.1 KB 4.5 MB/s eta 0:00:00
Collecting MarkupSafe==2.1.1
Downloading MarkupSafe-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Collecting packaging==21.3
Downloading packaging-21.3-py3-none-any.whl (40 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.8/40.8 KB 7.4 MB/s eta 0:00:00
Collecting progressbar33==2.4
Downloading progressbar33-2.4.tar.gz (10 kB)
Preparing metadata (setup.py) ... done
Collecting pyparsing==3.0.9
Downloading pyparsing-3.0.9-py3-none-any.whl (98 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.3/98.3 KB 20.3 MB/s eta 0:00:00
Collecting XlsxWriter==3.0.3
Downloading XlsxWriter-3.0.3-py3-none-any.whl (149 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 150.0/150.0 KB 10.8 MB/s eta 0:00:00
Using legacy 'setup.py install' for progressbar33, since package 'wheel' is not installed.
Installing collected packages: progressbar33, altgraph, XlsxWriter, pyparsing, MarkupSafe, packaging, Jinja2
Running setup.py install for progressbar33 ... done
Successfully installed Jinja2-3.1.2 MarkupSafe-2.1.1 XlsxWriter-3.0.3 altgraph-0.17.2 packaging-21.3 progressbar33-2.4 pyparsing-3.0.9
(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton#


用sample示範

root@ip-10-0-5-161:~/porting-advisor-for-graviton# ls sample-projects/
dotnet-samples go-samples java-samples node-samples python-samples ruby-samples
root@ip-10-0-5-161:~/porting-advisor-for-graviton#


執行檢查

(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton#
(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton# python3 src/porting-advisor.py sample-projects/python-samples
| Elapsed Time: 0:00:03

Porting Advisor for Graviton v1.0.0
Report date: 2023-03-02 07:06:27

4 files scanned.
detected python code. if you need pip, version 19.3 or above is recommended. we detected that you have version 22.0.2.
detected python code. min version 3.7.5 is required. we detected that you have version 3.10.6. see https://github.com/aws/aws-graviton-getting-started/blob/main/python.md for mo
re details.
sample-projects/python-samples/incompatible/requirements.txt:3: using dependency library openblas version 0.3.16. upgrade to at least version 0.3.17
sample-projects/python-samples/incompatible/requirements.txt:5: dependency library numpy is present. min version 1.19.0 is required.

Report generated successfully. Hint: you can use --output FILENAME.html to generate an HTML report.
(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton#


檢查發現了以下兩個需要升級

  • openblas
  • numpy
(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton# cat sample-projects/python-samples/incompatible/requirements.txt
# Porting Advisor for Graviton test file

OpenBLAS>=0.3.16
SciPy>=1.7.1
NumPy
FakeDependency>=1.2.3(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton#


產生報告 html、json、csv、txt

(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton#
(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton# python3 src/porting-advisor.py sample-projects/python-samples --output report.html
| Elapsed Time: 0:00:03

Porting Advisor for Graviton v1.0.0
Report date: 2023-03-02 07:10:38

Report saved at: report.html
(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton# python3 src/porting-advisor.py sample-projects/python-samples --output report.json
| Elapsed Time: 0:00:03

Porting Advisor for Graviton v1.0.0
Report date: 2023-03-02 07:11:17

Report saved at: report.json
(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton# python3 src/porting-advisor.py sample-projects/python-samples --output report.csv
| Elapsed Time: 0:00:03

Porting Advisor for Graviton v1.0.0
Report date: 2023-03-02 07:11:27

Report saved at: report.csv
(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton# python3 src/porting-advisor.py sample-projects/python-samples --output report.txt
| Elapsed Time: 0:00:02

Porting Advisor for Graviton v1.0.0
Report date: 2023-03-02 07:11:35

Report saved at: report.txt
(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton#
(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton# ls report.*
report.csv report.html report.json report.txt
(.venv) root@ip-10-0-5-161:~/porting-advisor-for-graviton#


report.json


{
"errors": [],
"issue_types": "-CompilerSpecific,-CrossCompile,-NoEquivalent",
"issues": [
"DependencyVersionIssue: sample-projects/python-samples/incompatible/requirements.txt:3: using dependency library openblas version 0.3.16. upgrade to at least version 0.
3.17"
],
"open_text_mode": "w",
"ported_inline_asm": 0,
"remarks": [
"LanguageVersionRemark: detected python code. min version 3.7.5 is required. we detected that you have version 3.10.6. see https://github.com/aws/aws-graviton-getting-st
arted/blob/main/python.md for more details.",
"ToolVersionRemark: detected python code. if you need pip, version 19.3 or above is recommended. we detected that you have version 22.0.2.",
"DependencyVersionRemark: sample-projects/python-samples/incompatible/requirements.txt:5: dependency library numpy is present. min version 1.19.0 is required."
],
"root_directory": "sample-projects/python-samples",
"self_process": false,
"send_filename": false,
"source_dirs": [
"sample-projects/python-samples/compatible",
"sample-projects/python-samples",
"sample-projects/python-samples/incompatible"
],
"source_files": [
"sample-projects/python-samples/main.py",
"sample-projects/python-samples/submain.py",
"sample-projects/python-samples/incompatible/requirements.txt",
"sample-projects/python-samples/compatible/requirements.txt"
],
"target_os": "linux"
}


report.txt

4 files scanned.
detected python code. if you need pip, version 19.3 or above is recommended. we detected that you have version 22.0.2.
detected python code. min version 3.7.5 is required. we detected that you have version 3.10.6. see https://github.com/aws/aws-graviton-getting-started/blob/main/python.md for more details.
sample-projects/python-samples/incompatible/requirements.txt:3: using dependency library openblas version 0.3.16. upgrade to at least version 0.3.17
sample-projects/python-samples/incompatible/requirements.txt:5: dependency library numpy is present. min version 1.19.0 is required.


report.html

raw-image



15會員
63Content count
留言0
查看全部
發表第一個留言支持創作者!
西尼亞ming的沙龍 的其他內容
AWS AMI Oracle Linux 7 包成 AMI 後,使用 AMI 啟動新 EC2 會遇到 Instance status checks fail 的問題 查看 system log 看到 EC2 開機時沒有抓到 eth0 ,導致 Instance status checks fai
Continue from here Prerequisites Create an IAM role with access to Bedrock Create an "IAM Role" that defines the permissions needed to call Bed
In the previous post, I tried it immediately from the Bedrock console. This time, I tried to use Bedrock from the programme, not from the console.
AWS Generative AI Service - Amazon Bedrock Launched April 2023 , 28 September 2023 Amazon Generative AI Service Amazon Bedrock is now officially relea
使AWS IAM User 可以查看 Billing 和 Cost Management console, 而不用登入Root User。 使用 Root User 登入 AWS 管理主控台 在導覽列上方右側點擊您的帳戶名稱,然後選擇 Account 頁面往下方,請選擇 IAM User
文/Ming Reserved Instance (RI) 相比較On-demand Instance,預留實例能夠節省高達 72% 的成本。你只需提交特定的Instance配置、Instance類型和可以是1年或3年的持續時間。 非常適合持續的工作負載,例如EC2、RDS、Elaticach
AWS AMI Oracle Linux 7 包成 AMI 後,使用 AMI 啟動新 EC2 會遇到 Instance status checks fail 的問題 查看 system log 看到 EC2 開機時沒有抓到 eth0 ,導致 Instance status checks fai
Continue from here Prerequisites Create an IAM role with access to Bedrock Create an "IAM Role" that defines the permissions needed to call Bed
In the previous post, I tried it immediately from the Bedrock console. This time, I tried to use Bedrock from the programme, not from the console.
AWS Generative AI Service - Amazon Bedrock Launched April 2023 , 28 September 2023 Amazon Generative AI Service Amazon Bedrock is now officially relea
使AWS IAM User 可以查看 Billing 和 Cost Management console, 而不用登入Root User。 使用 Root User 登入 AWS 管理主控台 在導覽列上方右側點擊您的帳戶名稱,然後選擇 Account 頁面往下方,請選擇 IAM User
文/Ming Reserved Instance (RI) 相比較On-demand Instance,預留實例能夠節省高達 72% 的成本。你只需提交特定的Instance配置、Instance類型和可以是1年或3年的持續時間。 非常適合持續的工作負載,例如EC2、RDS、Elaticach
你可能也想看
Thumbnail
1.加權指數與櫃買指數 週五的加權指數在非農就業數據開出來後,雖稍微低於預期,但指數仍向上噴出,在美股開盤後於21500形成一個爆量假突破後急轉直下,就一路收至最低。 台股方面走勢需觀察週一在斷頭潮出現後,週二或週三開始有無買單進場支撐,在沒有明確的反轉訊號形成前,小夥伴盡量不要貿然抄底,或是追空
Thumbnail
重點摘要: 1.9 月降息 2 碼、進一步暗示年內還有 50 bp 降息 2.SEP 上修失業率預期,但快速的降息速率將有助失業率觸頂 3.未來幾個月經濟數據將繼續轉弱,經濟復甦的時點或是 1Q25 季底附近
Thumbnail
近期的「貼文發佈流程 & 版型大更新」功能大家使用了嗎? 新版式整體視覺上「更加凸顯圖片」,為了搭配這次的更新,我們推出首次貼文策展 ❤️ 使用貼文功能並完成這次的指定任務,還有機會獲得富士即可拍,讓你的美好回憶都可以用即可拍珍藏!
Thumbnail
經濟的不確定性和員工偏好的變化,已經改變了招募的動態。這使得對於企業和甚至是支援這些努力的代理夥伴來說,招募頂尖人才變得具有挑戰性。雖然熟練的招募者擅長傳統的招募方法,但數位行銷人員也可以為確保招募過程的效率和效果提供幫助。例如使用付費點擊廣告可以對吸引和招募任何行業的人才產生巨大的影響。
Thumbnail
想要在 Google Sheet 中自動獲取台灣的天氣資訊?你可以使用 Google Apps Script,這是 Google 提供的一個程式化工具,能夠在 Google Sheet 中執行自訂的腳本,讓你自動從中央氣象局獲取天氣資訊並將其寫入你指定的 Google Sheet。
https://tinyurl.com/2dh8qnw3 Docs Using AI? Some Love It, Most Remain Wary 一些醫生嘗試使用 AI 工具,但有的發現 ChatGPT-3 犯了錯誤而停止使用,有的則樂於使用並打算更多使用。 ChatGPT-3 可
Thumbnail
Potato Media雖然和方格子及Matters同樣歸類為寫作平台,同樣強調將內容變現,前者卻與後面兩者完全不同,當然,所獲得的收入報酬也不會一樣,更清楚一點來說,連獲得收益的方式也大不相同。
Thumbnail
只將合成原料用來調整氣味的作法,和一般調香師的思維背道而馳。若是你/妳想要學習仿香,那這篇文章並不適合你。但如果你喜歡天然原料,但又想作出商業香水的輕盈感、明亮度、持久力,那你可以參考看看我們的作法。 我們會接續【在天然香水配方裏添加合成原料】這篇,介紹更多的合成原料/單體。
Thumbnail
戶外的步道磚,因為常年受陽光與雨水的滋潤,常常產生青苔。
Thumbnail
使用免費卷商軟體~"頁簽" 搭配技術分析~可以讓看盤更輕鬆 #目前較推薦”華南永昌證卷"的---可以存檔研究 有頁簽的~凱基/國票/玉山--皆無法存檔 使用方式:1.自訂-新增 2.選擇要的方式 3.如6格.按開啟 指標設定就用大家習慣的方式囉 也可以用來比較
Thumbnail
有時候會想要看一些東南亞的基礎報告,像是經濟成長、人口分佈、上網習慣等等,除了三月間我分享的這份報告,非常詳實而且免費,幾乎是很難挖到什麼寶貝的。
Thumbnail
1.加權指數與櫃買指數 週五的加權指數在非農就業數據開出來後,雖稍微低於預期,但指數仍向上噴出,在美股開盤後於21500形成一個爆量假突破後急轉直下,就一路收至最低。 台股方面走勢需觀察週一在斷頭潮出現後,週二或週三開始有無買單進場支撐,在沒有明確的反轉訊號形成前,小夥伴盡量不要貿然抄底,或是追空
Thumbnail
重點摘要: 1.9 月降息 2 碼、進一步暗示年內還有 50 bp 降息 2.SEP 上修失業率預期,但快速的降息速率將有助失業率觸頂 3.未來幾個月經濟數據將繼續轉弱,經濟復甦的時點或是 1Q25 季底附近
Thumbnail
近期的「貼文發佈流程 & 版型大更新」功能大家使用了嗎? 新版式整體視覺上「更加凸顯圖片」,為了搭配這次的更新,我們推出首次貼文策展 ❤️ 使用貼文功能並完成這次的指定任務,還有機會獲得富士即可拍,讓你的美好回憶都可以用即可拍珍藏!
Thumbnail
經濟的不確定性和員工偏好的變化,已經改變了招募的動態。這使得對於企業和甚至是支援這些努力的代理夥伴來說,招募頂尖人才變得具有挑戰性。雖然熟練的招募者擅長傳統的招募方法,但數位行銷人員也可以為確保招募過程的效率和效果提供幫助。例如使用付費點擊廣告可以對吸引和招募任何行業的人才產生巨大的影響。
Thumbnail
想要在 Google Sheet 中自動獲取台灣的天氣資訊?你可以使用 Google Apps Script,這是 Google 提供的一個程式化工具,能夠在 Google Sheet 中執行自訂的腳本,讓你自動從中央氣象局獲取天氣資訊並將其寫入你指定的 Google Sheet。
https://tinyurl.com/2dh8qnw3 Docs Using AI? Some Love It, Most Remain Wary 一些醫生嘗試使用 AI 工具,但有的發現 ChatGPT-3 犯了錯誤而停止使用,有的則樂於使用並打算更多使用。 ChatGPT-3 可
Thumbnail
Potato Media雖然和方格子及Matters同樣歸類為寫作平台,同樣強調將內容變現,前者卻與後面兩者完全不同,當然,所獲得的收入報酬也不會一樣,更清楚一點來說,連獲得收益的方式也大不相同。
Thumbnail
只將合成原料用來調整氣味的作法,和一般調香師的思維背道而馳。若是你/妳想要學習仿香,那這篇文章並不適合你。但如果你喜歡天然原料,但又想作出商業香水的輕盈感、明亮度、持久力,那你可以參考看看我們的作法。 我們會接續【在天然香水配方裏添加合成原料】這篇,介紹更多的合成原料/單體。
Thumbnail
戶外的步道磚,因為常年受陽光與雨水的滋潤,常常產生青苔。
Thumbnail
使用免費卷商軟體~"頁簽" 搭配技術分析~可以讓看盤更輕鬆 #目前較推薦”華南永昌證卷"的---可以存檔研究 有頁簽的~凱基/國票/玉山--皆無法存檔 使用方式:1.自訂-新增 2.選擇要的方式 3.如6格.按開啟 指標設定就用大家習慣的方式囉 也可以用來比較
Thumbnail
有時候會想要看一些東南亞的基礎報告,像是經濟成長、人口分佈、上網習慣等等,除了三月間我分享的這份報告,非常詳實而且免費,幾乎是很難挖到什麼寶貝的。