{"id":2158,"date":"2021-10-18T08:00:00","date_gmt":"2021-10-18T08:00:00","guid":{"rendered":"https:\/\/en.pingcap.com\/?p=2158"},"modified":"2023-09-10T20:22:50","modified_gmt":"2023-09-11T03:22:50","slug":"how-webassembly-powers-databases-build-a-udf-engine-with-wasm","status":"publish","type":"post","link":"https:\/\/www.pingcap.com\/ko\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/","title":{"rendered":"How WebAssembly Powers Databases: Build a UDF Engine with WASM"},"content":{"rendered":"<p><strong>Author:<\/strong>&nbsp;<a href=\"https:\/\/github.com\/TennyZhuang\">Tenny Zhuang<\/a>&nbsp;(TiKV committer)<\/p>\n\n\n\n<p><strong>Transcreator:<\/strong>&nbsp;<a href=\"https:\/\/github.com\/ran-huang\">Ran Huang<\/a>;&nbsp;<strong>Editor:<\/strong>&nbsp;Tom Dewan<\/p>\n\n\n\n<p><em><span style=\"color:#abb8c3\" class=\"tadv-color\">This article is based on a project at&nbsp;<a href=\"https:\/\/www.pingcap.com\/ko\/community\/events\/hackathon2020\/\">TiDB Hackathon 2020<\/a>.<\/span><\/em><\/p>\n\n\n\n<p>User-defined functions (UDFs) are an important extension to the SQL language. When you want to do customized computations in a database, you can write the desired computation logic as a UDF and pass it to the database. But not all DBMSs accept UDFs. For those that don&#8217;t, a UDF engine is the solution we need.<\/p>\n\n\n\n<p>That&#8217;s why we built a UDF engine that gives&nbsp;<a href=\"https:\/\/www.pingcap.com\/ko\/products\/tidb\/\">\ud2f0DB<\/a>, an open source database, the ability to execute UDFs. Based on&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/WebAssembly\" target=\"_blank\" rel=\"noreferrer noopener\">WebAssembly<\/a>&nbsp;(Wasm), this UDF engine boasts near-native performance and high flexibility. You can create functions using your familiar languages and greatly extend the capabilities of your database.<\/p>\n\n\n\n<p>In this article, I&#8217;ll share why and how we built the UDF engine, its outstanding features, and how we look forward to tapping into more of its potential.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"why-we-need-a-udf-engine\"><span class=\"ez-toc-section\" id=\"Why_we_need_a_UDF_engine\"><\/span>Why we need a UDF engine<a href=\"https:\/\/www.pingcap.com\/ko\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#why-we-need-a-udf-engine\"><\/a><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Built-in SQL functions are often too simplistic to handle complex and volatile real-world business situations. To keep up with the business logic, sometimes, you need to create customized functions. Some DBMSs provide a UDF feature that allows you to write your own function logic and perform the computation in the database, thereby simplifying the application logic.<\/p>\n\n\n\n<p>With UDFs, a database can:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Supplement unsupported functions.<\/li>\n\n\n\n<li>Request cloud resources to perform computations.<\/li>\n\n\n\n<li>Integrate the cloud database with your microservices via a VPC peering connection.<\/li>\n<\/ul>\n\n\n\n<p>Although it is such an important feature for meeting diversified user requirements, some DBMSs don&#8217;t provide it. For on-prem, open-source databases like TiDB, you can alter the database code and add built-in functions that meet your business needs. However, in the cloud-native era, users often can&#8217;t touch the database binaries. TiDB also offers its Database as a Service (DBaaS) solutions on the cloud. In this case, users must have a UDF engine to create their own functions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"building-a-wasm-based-udf-engine\"><span class=\"ez-toc-section\" id=\"Building_a_Wasm-based_UDF_engine\"><\/span>Building a Wasm-based UDF engine<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"why-wasm\"><a href=\"https:\/\/www.pingcap.com\/ko\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#why-wasm\"><\/a>Why Wasm?<\/h3>\n\n\n\n<p>To build a UDF engine on top of TiDB, we needed a secure, high-performance, and lightweight VM. We chose&nbsp;<strong><a href=\"https:\/\/webassembly.org\/\">WebAssembly<\/a><\/strong>&nbsp;(Wasm).<\/p>\n\n\n\n<p>Wasm is a binary instruction format designed for secure execution in the sandboxed environment. It allows you to execute code written in other languages at near-native speed, so it&#8217;s a suitable extension for performance-sensitive systems like databases. In recent years, many infrastructure projects (including&nbsp;<a href=\"https:\/\/www.envoyproxy.io\/\">Envoy<\/a>&nbsp;\uadf8\ub9ac\uace0&nbsp;<a href=\"https:\/\/www.redhat.com\/en\/technologies\/cloud-computing\/openshift\">OpenShift<\/a>) have adopted Wasm to add extensibility.<\/p>\n\n\n\n<p>We also chose&nbsp;<strong><a href=\"https:\/\/docs.wasmer.io\/\">Wasmer<\/a><\/strong>&nbsp;as a server-side runtime for Wasm and embedded it in TiDB&#8217;s executor. Wasmer integrates with many programming languages, such as C, C++, Go, and Rust. It supports&nbsp;<strong>LLVM<\/strong>&nbsp;compilers, which enables fast Wasm bytecode compilation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"highlights\"><a href=\"https:\/\/www.pingcap.com\/ko\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#highlights\"><\/a>Highlights<\/h3>\n\n\n\n<p><strong>Our UDF engine is fast.<\/strong>&nbsp;To benchmark UDF performance, we implemented an&nbsp;<a href=\"https:\/\/github.com\/tidb-hackathon-2020-wasm-udf\/tidb\/commit\/bbcf0d5748a6462e1030bca07b30d848ea250648\"><code>n-body<\/code><\/a>&nbsp;function using our UDF engine and then implemented two more&nbsp;<code>n-body<\/code>&nbsp;functions using TiDB and TiKV&#8217;s native code (Go and Rust). The results show that UDF&nbsp;<code>n-body<\/code>&nbsp;execution speed is close to Rust and higher than Go.<\/p>\n\n\n\n<p><strong>The UDF engine is highly flexible.<\/strong>&nbsp;Theoretically, you can write your UDF in almost any of your favorite languages, given a toolchain that compiles your code into Wasm bytecode. We already developed a set of toolchains for Rust, Go, and C so that their code is compiled into our expected bytecode format.<\/p>\n\n\n\n<p><strong>The UDF engine is secure.<\/strong>&nbsp;In the sandbox environment, the UDF engine can only execute limited instructions, without the risk of executing malicious code or invoking system calls. This makes the UDF engine a safe sandbox on the cloud. But its power is not crippled: it can still call the host system&#8217;s APIs.<\/p>\n\n\n\n<p><strong>Wasm bytecode is platform agnostic.<\/strong>&nbsp;You don&#8217;t need to think about whether the database is on x86 or Arm. You submit your bytecode once, and your custom function can be executed across all TiDB nodes, be they on x86 or Arm.<\/p>\n\n\n\n<p><strong>It&#8217;s easy to create and run a UDF.<\/strong>&nbsp;Simply write the function in your favorite programming language and compile it to Wasm bytecode using&nbsp;<a href=\"https:\/\/emscripten.org\/\">emscripten<\/a>. Then you can pass the bytecode into TiDB using&nbsp;<code>CREATE FUNCTION<\/code>&nbsp;and run it like a built-in function. The machine code is stored in a system table. The first time the function is executed, TiDB compiles the code and caches it on the current node.<\/p>\n\n\n<p style=\"text-align: center;\"><a class=\"button\" href=\"\/ko\/download\/\">Download TiDB<\/a>\u00a0 <a class=\"button\" href=\"https:\/\/share.hsforms.com\/1e2W03wLJQQKPd1d9rCbj_Q2npzm?__hstc=86493575.b22a95f50f9cad71c6c63a59b5a62e07.1624585358610.1637051752508.1637074535658.196&amp;__hssc=86493575.2.1637074535658&amp;__hsfp=1845858831\">Subscribe to Blog<\/a><\/p>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"UDF_and_beyond\"><\/span>UDF and beyond<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Besides the features we&#8217;ve already mentioned, Wasm-based UDF opens up more possibilities for TiDB.<\/p>\n\n\n\n<p><strong>UDFs can replace the stored procedure feature.<\/strong>&nbsp;They can expose controlled internal interfaces to execute queries or update data, which achieves a stored procedure-like effect. Traditional stored procedures consume database resources, use non-standard syntax, and often can&#8217;t be ported. The Wasm-based UDF mechanism prevails because it:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Accepts any general-purpose language (GPL) that can be compiled to Wasm. GPL is portable and can express more complex logic than domain-specific languages.<\/li>\n\n\n\n<li>Adapts to any architecture\u2014compile once, run anywhere.<\/li>\n\n\n\n<li>With the just-in-time compilation, Wasm stored procedures achieve near-native speed.<\/li>\n<\/ul>\n\n\n\n<p><strong>UDFs can be used in custom triggers to improve observability.<\/strong>&nbsp;Custom triggers can call UDFs in the event of data update, timestamp distribution, calculation pushdown, data replication, or any operations that are worth observing. The UDFs can efficiently collect metrics in TiDB and report them to other systems.<\/p>\n\n\n\n<p><strong>Cloud-based UDFs can connect the database with other systems over the cloud.<\/strong>&nbsp;A UDF can read data from object storage to achieve heterogeneous storage, or call machine learning models to perform face recognition and then join the recognition results with other tables. With UDFs, you can perform all these operations inside TiDB.<\/p>\n\n\n\n<p>When we implemented this UDF engine using Wasm, we actually realized the tremendous potential Wasm has in server-side applications. If Wasm gains traction in more systems, it will bring users powerful and flexible customizability while ensuring data security. Solomon Hykes, the founder of Docker, once&nbsp;<a href=\"https:\/\/twitter.com\/solomonstre\/status\/1111004913222324225\">said<\/a>&nbsp;that&nbsp;<strong>WebAssembly on the server is the future of computing<\/strong>. We, too, believe in that future, and we hope that our small project will give more people a peek into it.<\/p>\n\n\n\n<p><em><span style=\"color:#abb8c3\" class=\"tadv-color\">This article was originally published on&nbsp;<a href=\"https:\/\/vmblog.com\/archive\/2021\/09\/20\/how-webassembly-powers-database-build-a-udf-engine-with-wasm.aspx#.YVUGBWYzb0p\">VMblog<\/a>.<\/span><\/em><a href=\"https:\/\/www.pingcap.com\/ko\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#building-a-wasm-based-udf-engine\"><\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>WebAssembly is a binary instruction format designed for secure and near-native execution in the sandboxed environment. This post shares how we use WebAssembly to build a user-defined function engine for TiDB.<\/p>","protected":false},"author":76,"featured_media":2160,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ub_ctt_via":"","footnotes":""},"categories":[6],"tags":[44],"class_list":["post-2158","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-engineering","tag-hackathon"],"acf":[],"featured_image_src":"https:\/\/static.pingcap.com\/files\/2021\/11\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm.png","author_info":{"display_name":"Tianyi Zhuang","author_link":"https:\/\/www.pingcap.com\/ko\/blog\/author\/tianyi-zhuang\/"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How WebAssembly Powers Databases: Build a UDF Engine with WASM | TiDB<\/title>\n<meta name=\"description\" content=\"In this article, we will share why and how we built the UDF engine, and how we look forward to tapping into more of its potential.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pingcap.com\/ko\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How WebAssembly Powers Databases: Build a UDF Engine with WASM | TiDB\" \/>\n<meta property=\"og:description\" content=\"In this article, we will share why and how we built the UDF engine, and how we look forward to tapping into more of its potential.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pingcap.com\/ko\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/\" \/>\n<meta property=\"og:site_name\" content=\"TiDB\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/pingcap2015\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-18T08:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-11T03:22:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/static.pingcap.com\/files\/2021\/11\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1501\" \/>\n\t<meta property=\"og:image:height\" content=\"501\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Tianyi Zhuang\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/static.pingcap.com\/files\/2021\/11\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm.png\" \/>\n<meta name=\"twitter:creator\" content=\"@PingCAP\" \/>\n<meta name=\"twitter:site\" content=\"@PingCAP\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tianyi Zhuang\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/\"},\"author\":{\"name\":\"Tianyi Zhuang\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/person\/77653ebab9da7797eedf4dc931796505\"},\"headline\":\"How WebAssembly Powers Databases: Build a UDF Engine with WASM\",\"datePublished\":\"2021-10-18T08:00:00+00:00\",\"dateModified\":\"2023-09-11T03:22:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/\"},\"wordCount\":1054,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.pingcap.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/static.pingcap.com\/files\/2021\/11\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm.png\",\"keywords\":[\"Hackathon\"],\"articleSection\":[\"Engineering\"],\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/\",\"url\":\"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/\",\"name\":\"How WebAssembly Powers Databases: Build a UDF Engine with WASM | TiDB\",\"isPartOf\":{\"@id\":\"https:\/\/www.pingcap.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/static.pingcap.com\/files\/2021\/11\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm.png\",\"datePublished\":\"2021-10-18T08:00:00+00:00\",\"dateModified\":\"2023-09-11T03:22:50+00:00\",\"description\":\"In this article, we will share why and how we built the UDF engine, and how we look forward to tapping into more of its potential.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#primaryimage\",\"url\":\"https:\/\/static.pingcap.com\/files\/2021\/11\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm.png\",\"contentUrl\":\"https:\/\/static.pingcap.com\/files\/2021\/11\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm.png\",\"width\":1501,\"height\":501},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pingcap.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How WebAssembly Powers Databases: Build a UDF Engine with WASM\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pingcap.com\/#website\",\"url\":\"https:\/\/www.pingcap.com\/\",\"name\":\"TiDB\",\"description\":\"TiDB | SQL at Scale\",\"publisher\":{\"@id\":\"https:\/\/www.pingcap.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pingcap.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pingcap.com\/#organization\",\"name\":\"PingCAP\",\"url\":\"https:\/\/www.pingcap.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png\",\"contentUrl\":\"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png\",\"width\":811,\"height\":232,\"caption\":\"PingCAP\"},\"image\":{\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/facebook.com\/pingcap2015\",\"https:\/\/x.com\/PingCAP\",\"https:\/\/linkedin.com\/company\/pingcap\",\"https:\/\/youtube.com\/channel\/UCuq4puT32DzHKT5rU1IZpIA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/person\/77653ebab9da7797eedf4dc931796505\",\"name\":\"Tianyi Zhuang\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg\",\"contentUrl\":\"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg\",\"caption\":\"Tianyi Zhuang\"},\"url\":\"https:\/\/www.pingcap.com\/ko\/blog\/author\/tianyi-zhuang\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How WebAssembly Powers Databases: Build a UDF Engine with WASM | TiDB","description":"In this article, we will share why and how we built the UDF engine, and how we look forward to tapping into more of its potential.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pingcap.com\/ko\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/","og_locale":"ko_KR","og_type":"article","og_title":"How WebAssembly Powers Databases: Build a UDF Engine with WASM | TiDB","og_description":"In this article, we will share why and how we built the UDF engine, and how we look forward to tapping into more of its potential.","og_url":"https:\/\/www.pingcap.com\/ko\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/","og_site_name":"TiDB","article_publisher":"https:\/\/facebook.com\/pingcap2015","article_published_time":"2021-10-18T08:00:00+00:00","article_modified_time":"2023-09-11T03:22:50+00:00","og_image":[{"width":1501,"height":501,"url":"https:\/\/static.pingcap.com\/files\/2021\/11\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm.png","type":"image\/png"}],"author":"Tianyi Zhuang","twitter_card":"summary_large_image","twitter_image":"https:\/\/static.pingcap.com\/files\/2021\/11\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm.png","twitter_creator":"@PingCAP","twitter_site":"@PingCAP","twitter_misc":{"Written by":"Tianyi Zhuang","Est. reading time":"5\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#article","isPartOf":{"@id":"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/"},"author":{"name":"Tianyi Zhuang","@id":"https:\/\/www.pingcap.com\/#\/schema\/person\/77653ebab9da7797eedf4dc931796505"},"headline":"How WebAssembly Powers Databases: Build a UDF Engine with WASM","datePublished":"2021-10-18T08:00:00+00:00","dateModified":"2023-09-11T03:22:50+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/"},"wordCount":1054,"commentCount":0,"publisher":{"@id":"https:\/\/www.pingcap.com\/#organization"},"image":{"@id":"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#primaryimage"},"thumbnailUrl":"https:\/\/static.pingcap.com\/files\/2021\/11\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm.png","keywords":["Hackathon"],"articleSection":["Engineering"],"inLanguage":"ko-KR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/","url":"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/","name":"How WebAssembly Powers Databases: Build a UDF Engine with WASM | TiDB","isPartOf":{"@id":"https:\/\/www.pingcap.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#primaryimage"},"image":{"@id":"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#primaryimage"},"thumbnailUrl":"https:\/\/static.pingcap.com\/files\/2021\/11\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm.png","datePublished":"2021-10-18T08:00:00+00:00","dateModified":"2023-09-11T03:22:50+00:00","description":"In this article, we will share why and how we built the UDF engine, and how we look forward to tapping into more of its potential.","breadcrumb":{"@id":"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/"]}]},{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#primaryimage","url":"https:\/\/static.pingcap.com\/files\/2021\/11\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm.png","contentUrl":"https:\/\/static.pingcap.com\/files\/2021\/11\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm.png","width":1501,"height":501},{"@type":"BreadcrumbList","@id":"https:\/\/www.pingcap.com\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pingcap.com\/"},{"@type":"ListItem","position":2,"name":"How WebAssembly Powers Databases: Build a UDF Engine with WASM"}]},{"@type":"WebSite","@id":"https:\/\/www.pingcap.com\/#website","url":"https:\/\/www.pingcap.com\/","name":"\ud2f0DB","description":"TiDB | SQL at Scale","publisher":{"@id":"https:\/\/www.pingcap.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pingcap.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/www.pingcap.com\/#organization","name":"PingCAP","url":"https:\/\/www.pingcap.com\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/","url":"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png","contentUrl":"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png","width":811,"height":232,"caption":"PingCAP"},"image":{"@id":"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/pingcap2015","https:\/\/x.com\/PingCAP","https:\/\/linkedin.com\/company\/pingcap","https:\/\/youtube.com\/channel\/UCuq4puT32DzHKT5rU1IZpIA"]},{"@type":"Person","@id":"https:\/\/www.pingcap.com\/#\/schema\/person\/77653ebab9da7797eedf4dc931796505","name":"Tianyi Zhuang","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.pingcap.com\/#\/schema\/person\/image\/","url":"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg","contentUrl":"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg","caption":"Tianyi Zhuang"},"url":"https:\/\/www.pingcap.com\/ko\/blog\/author\/tianyi-zhuang\/"}]}},"grav_blocks":false,"card_markup":"<a class=\"card-resource bg-white\" href=\"https:\/\/www.pingcap.com\/ko\/blog\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm\/\"><div class=\"card-resource__image-container\"><img class=\"card-resource__image\" alt=\"how-webassembly-powers-databases-build-a-udf-engine-with-wasm\" src=\"https:\/\/static.pingcap.com\/files\/2021\/11\/how-webassembly-powers-databases-build-a-udf-engine-with-wasm.png\" loading=\"lazy\" width=1501 height=501 \/><\/div><div class=\"card-resource__content-container\"><div class=\"card-resource__content-head\"><div class=\"card-resource__category\">Engineering<\/div><\/div><h5 class=\"card-resource__title\">How WebAssembly Powers Databases: Build a UDF Engine with WASM<\/h5><\/div><\/a>","_links":{"self":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts\/2158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/users\/76"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/comments?post=2158"}],"version-history":[{"count":6,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts\/2158\/revisions"}],"predecessor-version":[{"id":13696,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts\/2158\/revisions\/13696"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/media\/2160"}],"wp:attachment":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/media?parent=2158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/categories?post=2158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/tags?post=2158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}