搜尋
首頁後端開發Python教學Polars Delta Lake:小數據方面的 Azure Function 與筆記型電腦

Polars   Delta Lake: Azure Function vs. Laptop on Small Data

您是否想知道 Azure 上的 Polars Deltalake 與消費性筆記型電腦的效能相比如何?
不?嗯,我有。如果我激起了您的好奇心,請繼續閱讀。

以下是參賽者

  1. EliteBook 840 G10,AMD Ryzen 7840U,8 核,16 線程,64 GB RAM
  2. 在 Linux B3 SKU 應用服務計畫上執行的 Azure Function(4 核,7 GB RAM)
    • 具有標準 ADLS2 儲存
    • 具有進階 ADLS2 儲存體

請參閱定價以取得可用應用程式服務方案的完整清單。

測試設定

測試測量三種場景

  1. 建立增量表
  2. 寫入增量表
  3. 從增量表讀取

程式碼透過 REST API 端點執行:

  1. polars_azure_create:https://function-hekori-learning-002.azurewebsites.net/api/polars/azure/create
  2. polars_azure_read:https://function-hekori-learning-002.azurewebsites.net/api/polars/azure/read
  3. polars_azure_write:https://function-hekori-learning-002.azurewebsites.net/api/polars/azure/write
  4. polars_local_create:http://localhost:7071/api/polars/local/create
  5. polars_local_read:http://localhost:7071/api/polars/local/read
  6. polars_local_write:http://localhost:7071/api/polars/local/write

在 HP EliteBook 上,我使用 func start 啟動 https://localhost:7071。
若要發佈到 Azure I,請依照 https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-python
中的說明進行操作 搭建必要的開發環境。這使我能夠透過
發布該函數 func azure functionapp 發佈 function-hekori-learning-002.

我使用 terraform 在北歐區域設定了 Azure 資源。

這是一個程式碼片段,顯示造訪 https://function-hekori-learning-002.azurewebsites.net/api/polars/azure/read
時執行的程式碼

@app.route(route="polars/azure/read", auth_level=func.AuthLevel.ANONYMOUS)
def polars_azure_read(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Reading from delta table')

    tic = time.time()
    df = pl.read_delta(AZURE_STORAGE_PATH, storage_options=storage_options
                       )

    df = df.sql(
        "select sum(value) as sum, avg(value) as mean, count() as count, name from self group by name order by sum asc"
    )

    toc = time.time()

    logging.info(f"Elapsed time {toc - tic:.2f} seconds")

    return func.HttpResponse(
        "Success from polars." + str(df) + '\n' + "Elapsed time " + str(toc - tic) + " seconds",
        status_code=200
    )

測試結果

如我們所見,HP EliteBook 在所有情況下都快了大約一個數量級。

Polars   Delta Lake: Azure Function vs. Laptop on Small Data

解釋

這是我個人的解讀

  1. Azure Function 計時對於同步任務來說足夠了。例如,用在 POST 請求中,客戶期望在
  2. 如果您的資料量較小且希望獲得最佳效能,您應該考慮在裸機或虛擬機器上執行具有低 IO 延遲的 Polars。

請注意,增量表的大小較小,只有 3 個提交和 2 個 parquet 檔案。即,運行時有效地測量計算單元存取檔案的開銷。

如果您❤️這篇文章,並且想要查看更大數據集的更多基準測試結果以進行核心處理,請給這篇文章一個?
並訂閱?到我的頻道???.

以上是Polars Delta Lake:小數據方面的 Azure Function 與筆記型電腦的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
您如何切成python列表?您如何切成python列表?May 02, 2025 am 12:14 AM

SlicingaPythonlistisdoneusingthesyntaxlist[start:stop:step].Here'showitworks:1)Startistheindexofthefirstelementtoinclude.2)Stopistheindexofthefirstelementtoexclude.3)Stepistheincrementbetweenelements.It'susefulforextractingportionsoflistsandcanuseneg

在Numpy陣列上可以執行哪些常見操作?在Numpy陣列上可以執行哪些常見操作?May 02, 2025 am 12:09 AM

numpyallowsforvariousoperationsonArrays:1)basicarithmeticlikeaddition,減法,乘法和division; 2)evationAperationssuchasmatrixmultiplication; 3)element-wiseOperations wiseOperationswithOutexpliitloops; 4)

Python的數據分析中如何使用陣列?Python的數據分析中如何使用陣列?May 02, 2025 am 12:09 AM

Arresinpython,尤其是Throughnumpyandpandas,weessentialFordataAnalysis,offeringSpeedAndeffied.1)NumpyArseNable efflaysenable efficefliceHandlingAtaSetSetSetSetSetSetSetSetSetSetSetsetSetSetSetSetsopplexoperationslikemovingaverages.2)

列表的內存足跡與python數組的內存足跡相比如何?列表的內存足跡與python數組的內存足跡相比如何?May 02, 2025 am 12:08 AM

列表sandnumpyArraysInpythonHavedIfferentMemoryfootprints:listSaremoreFlexibleButlessMemory-效率,而alenumpyArraySareSareOptimizedFornumericalData.1)listsStorReereReereReereReereFerenceStoObjects,with withOverHeadeBheadaroundAroundaround64byty64-bitsysysysysysysysysyssyssyssyssysssyssys2)

部署可執行的Python腳本時,如何處理特定環境的配置?部署可執行的Python腳本時,如何處理特定環境的配置?May 02, 2025 am 12:07 AM

toensurepythonscriptsbehavecorrectlyacrycrosdevelvermations,分期和生產,USETHESTERTATE:1)Environment varriablesForsimplesettings,2)configurationfilesfilesForcomPlexSetups,3)dynamiCofforComplexSetups,dynamiqualloadingForaptaptibality.eachmethodoffersuniquebeneiquebeneqeniquebenefitsandrefitsandrequiresandrequiresandrequiresca

您如何切成python陣列?您如何切成python陣列?May 01, 2025 am 12:18 AM

Python列表切片的基本語法是list[start:stop:step]。 1.start是包含的第一個元素索引,2.stop是排除的第一個元素索引,3.step決定元素之間的步長。切片不僅用於提取數據,還可以修改和反轉列表。

在什麼情況下,列表的表現比數組表現更好?在什麼情況下,列表的表現比數組表現更好?May 01, 2025 am 12:06 AM

ListSoutPerformarRaysin:1)DynamicsizicsizingandFrequentInsertions/刪除,2)儲存的二聚體和3)MemoryFeliceFiceForceforseforsparsedata,butmayhaveslightperformancecostsinclentoperations。

如何將Python數組轉換為Python列表?如何將Python數組轉換為Python列表?May 01, 2025 am 12:05 AM

toConvertapythonarraytoalist,usEthelist()constructororageneratorexpression.1)intimpthearraymoduleandcreateanArray.2)USELIST(ARR)或[XFORXINARR] to ConconverTittoalist,請考慮performorefformanceandmemoryfformanceandmemoryfformienceforlargedAtasetset。

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

MantisBT

MantisBT

Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

SublimeText3 Linux新版

SublimeText3 Linux新版

SublimeText3 Linux最新版

SecLists

SecLists

SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。