{"id":122826,"date":"2026-11-05T19:49:06","date_gmt":"2026-11-05T11:49:06","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/122826.html"},"modified":"2026-11-05T19:49:06","modified_gmt":"2026-11-05T11:49:06","slug":"fastpysgi-%e5%9f%ba%e5%87%86%e6%b5%8b%e8%af%95%e5%ae%9e%e7%8e%b0%e8%a7%a3%e6%9e%90%ef%bc%9a%e5%9f%ba%e4%ba%8e-libuv-%e4%b8%8e-llhttp-%e7%9a%84-python-wsgi-asgi-%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/122826.html","title":{"rendered":"FastPySGI \u57fa\u51c6\u6d4b\u8bd5\u5b9e\u73b0\u89e3\u6790\uff1a\u57fa\u4e8e libuv \u4e0e llhttp \u7684 Python WSGI\/ASGI \u670d\u52a1\u5668"},"content":{"rendered":"<ul class=\"gcb-tag-list\">\n<li><span class=\"gcb-tag\">\u6027\u80fd\u6d4b\u8bd5<\/span><\/li>\n<li><span class=\"gcb-tag\">\u6d4b\u8bd5<\/span><\/li>\n<li><span class=\"gcb-tag\">\u540e\u7aef<\/span><\/li>\n<li><span class=\"gcb-tag\">\u5f00\u53d1\u8005\u5de5\u5177<\/span><\/li>\n<\/ul>\n<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011FrameworkBenchmarks<\/h3>\n<p class=\"gcb-project-desc\">Source for the TechEmpower Framework Benchmarks project<\/p>\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/gh_mirrors\/fr\/FrameworkBenchmarks<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<p>\u672c\u6307\u5357\u4ee5 FrameworkBenchmarks \u4ed3\u5e93\u4e2d FastPySGI \u6d4b\u8bd5\u76ee\u5f55 \u4e3a\u84dd\u672c&#xff0c;\u7cfb\u7edf\u8bb2\u89e3 FastPySGI \u8fd9\u4e00\u57fa\u4e8e libuv \u4e8b\u4ef6\u5faa\u73af\u7684 Python 3 \u5f02\u6b65\u670d\u52a1\u5668\u7684\u6280\u672f\u6784\u6210&#xff0c;\u4ee5\u53ca\u5b83\u5728 TechEmpower \u57fa\u51c6\u6d4b\u8bd5\u5957\u4ef6\u4e2d\u7684 WSGI\u3001ASGI \u53cc\u5b9e\u73b0\u65b9\u5f0f\u3002\u8bfb\u5b8c\u672c\u6587&#xff0c;\u4f60\u5c06\u638c\u63e1 FastPySGI \u7684\u67b6\u6784\u539f\u7406\u3001app.py \u4e0e app-asgi.py \u4e24\u5957\u6d4b\u8bd5\u5165\u53e3\u7684\u5b8c\u6574\u8def\u7531\u5b9e\u73b0\u3001benchmark_config.json \u4e0e config.toml \u4e2d\u6d4b\u8bd5\u6863\u4f4d\u7684\u914d\u7f6e\u65b9\u6cd5&#xff0c;\u4ee5\u53ca\u5982\u4f55\u501f\u52a9 tfb &#8211;mode verify &#8211;test fastpysgi \u5728\u672c\u5730\u9a8c\u8bc1\u8be5\u6d4b\u8bd5\u3002<\/p>\n<h3>FastPySGI \u662f\u4ec0\u4e48<\/h3>\n<p>FastPySGI \u662f\u4e00\u4e2a\u9762\u5411 Python 3 \u7684 asyncio \u9ad8\u6027\u80fd\u670d\u52a1\u5668&#xff0c;\u5176\u6838\u5fc3\u8bbe\u8ba1\u662f\u501f\u52a9 C \u5e93\u5c06\u6700\u7e41\u91cd\u7684\u7f51\u7edc\u4e0e\u89e3\u6790\u5de5\u4f5c\u4e0b\u6c89\u5230\u539f\u751f\u5c42&#xff1a;<\/p>\n<ul>\n<li>libuv&#xff1a;\u591a\u5e73\u53f0 C \u5e93&#xff0c;\u63d0\u4f9b\u57fa\u4e8e\u4e8b\u4ef6\u5faa\u73af\u7684\u5f02\u6b65 I\/O \u652f\u6301&#xff0c;\u8fd9\u4e5f\u662f Node.js \u540c\u6b3e\u7684\u4e8b\u4ef6\u5faa\u73af\u57fa\u77f3&#xff1b;<\/li>\n<li>llhttp&#xff1a;Node.js \u793e\u533a\u7ef4\u62a4\u7684 HTTP \u89e3\u6790\u5e93&#xff0c;\u4ee5\u89e3\u6790\u901f\u5ea6\u5feb\u8457\u79f0&#xff1b;<\/li>\n<li>WSGI\/ASGI \u6d88\u8d39\u8005\u63a5\u53e3&#xff1a;\u7528\u4e8e\u4e0e\u5e94\u7528\u5c42\u4ea4\u4e92&#xff0c;\u4f7f FastPySGI \u540c\u65f6\u5177\u5907\u63a5\u5165\u7ecf\u5178 WSGI \u5e94\u7528\u4e0e\u65b0\u578b ASGI \u5e94\u7528\u7684\u80fd\u529b\u3002<\/li>\n<\/ul>\n<p>\u5728 fastpysgi\/README.md \u4e2d&#xff0c;\u4f5c\u8005\u5c06\u5176\u5b9a\u4f4d\u4e3a &#034;lightning fast asyncio server&#034;&#xff08;\u57fa\u4e8e libuv \u7684\u6781\u901f asyncio \u670d\u52a1\u5668&#xff09;\u3002\u503c\u5f97\u8bf4\u660e\u7684\u662f&#xff0c;\u672c\u9879\u76ee\u4e2d\u7684\u5b9e\u73b0\u8fd8\u53c2\u8003\u4e86\u540c\u4e3a\u6781\u7b80\u8bbe\u8ba1\u7684 FastWSGI&#xff08;README \u7684 Resources \u4e00\u8282\u5c06\u5176\u5217\u4e3a\u5173\u8054\u8d44\u6e90&#xff09;&#xff0c;\u4e24\u8005\u5747\u8d70&#034;\u5355\u6587\u4ef6\u3001\u96f6\u6846\u67b6\u4f9d\u8d56&#034;\u7684\u5b9e\u73b0\u8def\u7ebf\u3002<\/p>\n<h3>\u6d4b\u8bd5\u76ee\u5f55\u7ed3\u6784\u4e0e\u914d\u7f6e\u6620\u5c04<\/h3>\n<p>\u5728 frameworks\/Python\/fastpysgi \u76ee\u5f55\u4e0b&#xff0c;\u6d4b\u8bd5\u5b9e\u73b0\u88ab\u7ec4\u7ec7\u4e3a\u5982\u4e0b\u6587\u4ef6&#xff1a;<\/p>\n<table>\n<tr>\u6587\u4ef6\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>app.py<\/td>\n<td>WSGI \u5165\u53e3&#xff0c;\u5b9e\u73b0 \/json \u4e0e \/plaintext<\/td>\n<\/tr>\n<tr>\n<td>app-asgi.py<\/td>\n<td>ASGI \u5165\u53e3&#xff0c;\u5b9e\u73b0\u5168\u90e8\u4e03\u7c7b\u6d4b\u8bd5\u8def\u5f84&#xff08;\u542b\u6570\u636e\u5e93\u6d4b\u8bd5&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>templates\/fortune.html<\/td>\n<td>Fortune \u6d4b\u8bd5\u7684 Jinja2 \u6a21\u677f<\/td>\n<\/tr>\n<tr>\n<td>benchmark_config.json<\/td>\n<td>\u6d4b\u8bd5\u5957\u4ef6\u8bfb\u53d6\u7684\u914d\u7f6e&#xff08;default \u4e0e asgi \u4e24\u4e2a\u6863\u4f4d&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>config.toml<\/td>\n<td>\u4e0e benchmark_config.json \u7b49\u4ef7\u7684 TOML \u914d\u7f6e<\/td>\n<\/tr>\n<tr>\n<td>fastpysgi.dockerfile<\/td>\n<td>WSGI \u6863\u4f4d\u7684\u5bb9\u5668\u6784\u5efa\u811a\u672c<\/td>\n<\/tr>\n<tr>\n<td>fastpysgi-asgi.dockerfile<\/td>\n<td>ASGI \u6863\u4f4d\u7684\u5bb9\u5668\u6784\u5efa\u811a\u672c<\/td>\n<\/tr>\n<tr>\n<td>requirements.txt<\/td>\n<td>Python \u4f9d\u8d56\u6e05\u5355<\/td>\n<\/tr>\n<tr>\n<td>README.md<\/td>\n<td>\u672c\u6d4b\u8bd5\u7684\u8bf4\u660e\u6587\u6863<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>README \u660e\u786e\u6307\u51fa&#xff1a;\u6240\u6709\u6d4b\u8bd5\u5b9e\u73b0\u90fd\u4f4d\u4e8e\u5355\u4e2a\u6587\u4ef6 app.py \u4e2d&#xff0c;\u5e76\u7ed9\u51fa\u4e24\u4e2a\u6d4b\u8bd5\u8def\u5f84\u6620\u5c04\u2014\u2014JSON Serialization \u5bf9\u5e94 \/json&#xff0c;Plaintext \u5bf9\u5e94 \/plaintext\u3002\u5b9e\u9645\u4e0a\u8be5\u76ee\u5f55\u4e0b\u8fd8\u5b58\u5728\u529f\u80fd\u66f4\u5b8c\u6574\u7684 ASGI \u7248\u672c app-asgi.py&#xff0c;\u4e24\u4e2a\u5165\u53e3\u5404\u81ea\u88ab benchmark_config.json \u4e2d\u7684\u4e0d\u540c\u6863\u4f4d\u5f15\u7528&#xff0c;\u8fd9\u4e00\u70b9\u5728\u540e\u7eed\u7ae0\u8282\u8be6\u7ec6\u5c55\u5f00\u3002<\/p>\n<h3>WSGI \u5b9e\u73b0&#xff1a;\u6781\u7b80\u7684\u5355\u6587\u4ef6\u8def\u7531<\/h3>\n<p>app.py \u662f FastPySGI \u7684 WSGI \u5b9e\u73b0&#xff0c;\u5168\u6587\u4ef6\u4ec5\u7ea6 60 \u884c&#xff0c;\u9075\u5faa\u7ecf\u5178 WSGI \u7b7e\u540d app(environ, start_response)\u3002\u6838\u5fc3\u4ee3\u7801 frameworks\/Python\/fastpysgi\/app.py#L10-L26 \u5c55\u793a\u4e86\u4e00\u6761\u5178\u578b\u7684 WSGI \u5904\u7406\u94fe\u8def&#xff1a;<\/p>\n<p>def app(environ, start_response):<br \/>\n    path &#061; environ[&#034;PATH_INFO&#034;]<br \/>\n    headers &#061; [ ]<\/p>\n<p>    if path &#061;&#061; &#034;\/json&#034;:<br \/>\n        headers.append( (&#039;Content-Type&#039;, &#039;application\/json&#039;) )<br \/>\n        start_response(&#039;200 OK&#039;, headers)<br \/>\n        return [ jsonify( {&#034;message&#034;:&#034;Hello, World!&#034;} ).encode(&#039;utf8&#039;) ]<\/p>\n<p>    if path &#061;&#061; &#034;\/plaintext&#034;:<br \/>\n        headers.append( (&#039;Content-Type&#039;, &#039;text\/plain&#039;) )<br \/>\n        start_response(&#039;200 OK&#039;, headers)<br \/>\n        return [ b&#039;Hello, World!&#039; ]<\/p>\n<p>    start_response(&#039;400 Bad Request&#039;, headers)<br \/>\n    return [ b&#039;&#039; ]<\/p>\n<p>\u51e0\u4e2a\u503c\u5f97\u6ce8\u610f\u7684\u5b9e\u73b0\u7ec6\u8282&#xff1a;<\/p>\n<ul>\n<li>JSON \u5e8f\u5217\u5316\u4f18\u5148\u4f7f\u7528 ujson&#xff1a;app.py \u9876\u90e8\u901a\u8fc7 try: from ujson import dumps as jsonify except: from json import dumps as jsonify \u505a\u53cc\u8def\u56de\u9000&#xff08;app.py#L4-L7&#xff09;&#xff0c;\u5373\u5728\u5177\u5907 ujson \u65f6\u7528 C \u6269\u5c55\u52a0\u901f\u5e8f\u5217\u5316&#xff0c;\u7f3a\u5931\u65f6\u56de\u9000\u5230\u6807\u51c6\u5e93&#xff0c;\u8fd9\u4e0e requirements.txt \u4e2d\u9501\u5b9a ujson&#061;&#061;5.12.0 \u7684\u7248\u672c\u4e00\u81f4&#xff1b;<\/li>\n<li>\u8def\u5f84\u5206\u53d1\u5b8c\u5168\u7531 PATH_INFO \u9a71\u52a8&#xff1a;\u4e0d\u5f15\u5165\u4efb\u4f55\u8def\u7531\u6846\u67b6&#xff0c;\/json \u8fd4\u56de application\/json \u54cd\u5e94\u4f53 {&#034;message&#034;:&#034;Hello, World!&#034;}&#xff0c;\/plaintext \u8fd4\u56de text\/plain \u54cd\u5e94\u4f53 Hello, World!&#xff0c;\u5176\u4f59\u8def\u5f84\u4e00\u5f8b\u56de 400 Bad Request&#xff1b;<\/li>\n<li>\u6ce8\u91ca\u4e2d\u7684 Server \u5934\u9ed8\u8ba4\u5173\u95ed&#xff1a;\u4ee3\u7801\u4e2d\u4fdd\u7559\u4e86 #headers &#061; [ (&#039;Server&#039;, &#039;FastPySGI&#039;) ] \u6ce8\u91ca&#xff0c;\u8bf4\u660e\u4f5c\u8005\u9ed8\u8ba4\u7701\u7565\u81ea\u5b9a\u4e49 Server \u54cd\u5e94\u5934\u4ee5\u538b\u7f29\u54cd\u5e94\u5b57\u8282\u6570\u3002<\/li>\n<\/ul>\n<h4>\u591a\u8fdb\u7a0b\u542f\u52a8\u6a21\u578b<\/h4>\n<p>__main__ \u5757&#xff08;app.py#L29-L55&#xff09;\u5c55\u793a\u4e86 FastPySGI \u5728\u57fa\u51c6\u6d4b\u8bd5\u4e2d\u7684\u5178\u578b\u90e8\u7f72\u65b9\u5f0f\u2014\u2014\u5229\u7528 os.fork() \u6309 CPU \u6838\u6570\u521b\u5efa\u591a\u4e2a worker \u8fdb\u7a0b&#xff1a;<\/p>\n<p>workers &#061; int(multiprocessing.cpu_count())<\/p>\n<p>host &#061; &#039;0.0.0.0&#039;<br \/>\nport &#061; 3000<\/p>\n<p>def run_app():<br \/>\n    fastpysgi.server.backlog &#061; 4096<br \/>\n    fastpysgi.run(app, host, port, loglevel&#061;2)<\/p>\n<p>def create_fork():<br \/>\n    n &#061; os.fork()<br \/>\n    if not n &gt; 0:<br \/>\n        run_app()<\/p>\n<p># fork limiting the cpu count &#8211; 1<br \/>\nfor i in range(1, workers):<br \/>\n    create_fork()<\/p>\n<p>run_app()  # run app on the main process too<\/p>\n<p>\u5173\u952e\u53c2\u6570\u542b\u4e49&#xff1a;<\/p>\n<ul>\n<li>port &#061; 3000&#xff1a;\u76d1\u542c\u7aef\u53e3&#xff0c;\u4e0e benchmark_config.json \u4e2d &#034;port&#034;: 3000 \u4e25\u683c\u5bf9\u5e94&#xff1b;<\/li>\n<li>host &#061; &#039;0.0.0.0&#039;&#xff1a;\u7ed1\u5b9a\u6240\u6709\u7f51\u5361\u63a5\u53e3&#xff0c;\u4fbf\u4e8e\u5bb9\u5668\u5185\u88ab wrk \u538b\u6d4b\u8bbf\u95ee&#xff1b;<\/li>\n<li>fastpysgi.server.backlog &#061; 4096&#xff1a;\u8c03\u9ad8 listen backlog \u961f\u5217\u957f\u5ea6&#xff0c;\u5728\u9ad8\u5e76\u53d1\u4e0b\u51cf\u5c11\u5185\u6838 accept \u961f\u5217\u4e22\u5305&#xff1b;<\/li>\n<li>loglevel&#061;2&#xff1a;\u65e5\u5fd7\u7ea7\u522b\u914d\u7f6e&#xff0c;\u6d4b\u8bd5\u8fd0\u884c\u65f6\u7528\u4e8e\u8f93\u51fa\u8bca\u65ad\u4fe1\u606f&#xff1b;<\/li>\n<li>\u542f\u52a8\u7b56\u7565\u662f&#034;\u4e3b\u8fdb\u7a0b &#043; N-1 \u4e2a fork \u5b50\u8fdb\u7a0b&#034;&#xff0c;\u6bcf\u4e2a\u5b50\u8fdb\u7a0b\u5404\u81ea\u8c03\u7528 fastpysgi.run() \u8fd0\u884c\u540c\u4e00\u5e94\u7528\u5b9e\u4f8b&#xff1b;\u5f53\u73af\u5883\u53d8\u91cf TRAVIS&#061;true \u65f6&#xff08;CI \u573a\u666f&#xff09;\u5f3a\u5236\u53ea\u542f\u52a8 2 \u4e2a worker&#xff0c;\u907f\u514d\u5728\u8d44\u6e90\u53d7\u9650\u73af\u5883\u6253\u6ee1 CPU\u3002<\/li>\n<\/ul>\n<h3>ASGI \u5b9e\u73b0&#xff1a;\u5168\u91cf\u6d4b\u8bd5\u8def\u5f84\u4e0e\u5f02\u6b65\u6570\u636e\u5e93\u8bbf\u95ee<\/h3>\n<p>app-asgi.py \u662f\u529f\u80fd\u66f4\u5b8c\u6574\u7684 ASGI \u5b9e\u73b0&#xff0c;README \u867d\u672a\u9010\u6761\u5217\u51fa&#xff0c;\u4f46\u5b83\u8986\u76d6\u4e86 TechEmpower \u5957\u4ef6\u7684\u5168\u90e8\u4e03\u7c7b\u6d4b\u8bd5\u3002\u5b83\u9075\u5faa ASGI \u4e09\u65b9\u534f\u8bae app(scope, receive, send)&#xff0c;\u5e76\u5229\u7528 lifespan \u534f\u8bae\u5728\u8fdb\u7a0b\u542f\u52a8\u9636\u6bb5\u521d\u59cb\u5316\u6570\u636e\u5e93\u8fde\u63a5\u6c60&#xff08;app-asgi.py#L232-L247&#xff09;\u3002<\/p>\n<h4>\u6570\u636e\u5e93\u8fde\u63a5\u6c60<\/h4>\n<p>db_setup()&#xff08;app-asgi.py#L28-L39&#xff09;\u57fa\u4e8e asyncpg \u5efa\u7acb\u5230 Postgres \u7684\u8fde\u63a5\u6c60&#xff1a;<\/p>\n<p>db_pool &#061; await asyncpg.create_pool(<br \/>\n    user&#061;os.getenv(&#039;PGUSER&#039;, &#039;benchmarkdbuser&#039;),<br \/>\n    password&#061;os.getenv(&#039;PGPASS&#039;, &#039;benchmarkdbpass&#039;),<br \/>\n    database&#061;&#039;hello_world&#039;,<br \/>\n    host&#061;&#039;tfb-database&#039;,<br \/>\n    port&#061;5432,<br \/>\n    min_size&#061;PG_POOL_SIZE,<br \/>\n    max_size&#061;PG_POOL_SIZE,<br \/>\n    connection_class&#061;NoResetConnection,<br \/>\n)<\/p>\n<p>\u5176\u4e2d PG_POOL_SIZE &#061; 4 \u4e3a\u56fa\u5b9a\u8fde\u63a5\u6c60\u5927\u5c0f&#xff1b;host&#061;&#039;tfb-database&#039; \u662f\u5957\u4ef6\u5185\u90e8\u7ea6\u5b9a\u3001\u7531 Docker Compose \u6ce8\u5165\u7684\u6570\u636e\u5e93\u5bb9\u5668\u4e3b\u673a\u540d&#xff1b;\u8fde\u63a5\u53c2\u6570 benchmarkdbuser\/benchmarkdbpass \u4e0e toolset\/databases\/postgres\/postgres.py \u4e2d\u6821\u9a8c\u7aef\u4f7f\u7528\u7684\u8d26\u53f7\u5bc6\u7801\u5b8c\u5168\u4e00\u81f4\u3002NoResetConnection \u7ee7\u627f\u81ea asyncpg.Connection \u5e76\u8986\u5199 get_reset_query() \u8fd4\u56de\u7a7a\u4e32&#xff0c;\u7528\u4e8e\u8df3\u8fc7\u8fde\u63a5\u5f52\u8fd8\u65f6\u7684 RESET \u67e5\u8be2&#xff0c;\u7701\u53bb\u4e0d\u5fc5\u8981\u7684\u5f80\u8fd4\u5f00\u9500\u3002<\/p>\n<h4>\u8def\u7531\u8868\u4e0e\u4e03\u7c7b\u6d4b\u8bd5<\/h4>\n<p>\u8def\u7531\u8868&#xff08;app-asgi.py#L221-L229&#xff09;\u5c06\u8def\u5f84\u6620\u5c04\u5230\u534f\u7a0b\u5904\u7406\u5668&#xff1a;<\/p>\n<p>routes &#061; {<br \/>\n    &#039;\/json&#039;: json_serialization,<br \/>\n    &#039;\/db&#039;: single_database_query,<br \/>\n    &#039;\/queries&#039;: multiple_database_queries,<br \/>\n    &#039;\/fortunes&#039;: fortunes,<br \/>\n    &#039;\/updates&#039;: database_updates,<br \/>\n    &#039;\/cached-queries&#039;: cached_queries,<br \/>\n    &#039;\/plaintext&#039;: plaintext,<br \/>\n}<\/p>\n<ul>\n<li>\/json \u4e0e \/plaintext&#xff1a;\u4e0e WSGI \u7248\u529f\u80fd\u4e00\u81f4&#xff0c;\u4f46\u6539\u7531 ASGI \u6d88\u606f\u7ed3\u6784\u53d1\u9001\u2014\u2014\u5148 send \u4e00\u4e2a http.response.start \u6d88\u606f\u58f0\u660e\u72b6\u6001\u7801\u4e0e Content-Type \u5934&#xff0c;\u518d send \u4e00\u4e2a http.response.body \u6d88\u606f\u643a\u5e26 more_body: False \u7684\u54cd\u5e94\u4f53&#xff1b;<\/li>\n<li>\/db \u5355\u6761\u6570\u636e\u5e93\u67e5\u8be2&#xff1a;random.randint(1, 10000) \u968f\u673a\u53d6 id&#xff0c;fetchval(READ_ROW_SQL, row_id) \u8bfb\u53d6 world \u8868\u7684 randomnumber&#xff0c;\u8fd4\u56de {&#034;id&#034;:&#8230;, &#034;randomNumber&#034;:&#8230;}&#xff08;app-asgi.py#L92-L107&#xff09;&#xff1b;<\/li>\n<li>\/queries \u591a\u6761\u67e5\u8be2&#xff1a;\u901a\u8fc7 get_num_queries(scope) \u89e3\u6790 queries \u67e5\u8be2\u53c2\u6570&#xff0c;\u7528 random.sample(range(1, 10000), num_queries) \u751f\u6210\u4e92\u4e0d\u91cd\u590d\u7684 id \u96c6&#xff0c;\u518d\u4ee5 fetchmany \u4e00\u6b21\u53d6\u56de&#xff1b;get_num_queries&#xff08;app-asgi.py#L69-L79&#xff09;\u5bf9\u53c2\u6570\u505a\u4e86 1&#xff5e;500 \u7684\u94b3\u5236\u2014\u2014\u5c0f\u4e8e 1 \u89c6\u4e3a 1&#xff0c;\u5927\u4e8e 500 \u94b3\u4e3a 500&#xff0c;\u975e\u6cd5\u8f93\u5165\u56de\u9000\u4e3a 1&#xff0c;\u8fd9\u4e0e toolset\/test_types\/verifications.py#L329-L349 \u4e2d verify_query_cases \u5bf9 queries \u53c2\u6570 0\u3001\u8d1f\u6570\u3001\u975e\u6570\u5b57\u3001501\u3001\u7a7a\u4e32\u7b49\u7528\u4f8b\u7684\u6821\u9a8c\u9884\u671f\u4e00\u81f4&#xff1b;<\/li>\n<li>\/fortunes&#xff1a;\u4ece\u6570\u636e\u5e93\u62c9\u53d6 Fortune \u8868\u5168\u90e8\u6570\u636e&#xff0c;\u8ffd\u52a0\u4e00\u884c [0, &#034;Additional fortune added at request time.&#034;] \u540e\u6309 id \u6392\u5e8f&#xff0c;\u4ea4\u7ed9 templates\/fortune.html \u4e2d\u7684 Jinja2 \u6a21\u677f\u6e32\u67d3&#xff0c;\u6a21\u677f\u5bf9 fortune[1] \u505a\u4e86 |e HTML \u8f6c\u4e49\u4ee5\u5904\u7406 XSS \u7528\u4f8b&#xff08;\u6570\u636e\u5e93\u7b2c 11 \u6761\u8bb0\u5f55\u5373\u5305\u542b &lt;script&gt; \u6807\u7b7e\u7684\u6d4b\u8bd5\u6570\u636e&#xff0c;\u89c1 create-postgres.sql&#xff09;&#xff1b;<\/li>\n<li>\/updates \u6570\u636e\u5e93\u66f4\u65b0&#xff1a;\u968f\u673a\u751f\u6210 id \u4e0e\u968f\u673a\u6570&#xff0c;\u5148 executemany(READ_ROW_SQL, &#8230;) \u9010\u6761\u8bfb\u53d6\u3001\u518d executemany(WRITE_ROW_SQL, updates) \u9010\u6761\u66f4\u65b0&#xff0c;\u8fd4\u56de\u66f4\u65b0\u540e\u7684 world \u5217\u8868&#xff1b;<\/li>\n<li>\/cached-queries \u7f13\u5b58\u67e5\u8be2&#xff1a;\u8fd9\u662f FastPySGI \u5b9e\u73b0\u7684\u4e00\u4e2a\u4eae\u70b9\u2014\u2014\u901a\u8fc7 asyncache \u7684 &#064;cached \u88c5\u9970\u5668\u914d\u5408 cachetools.keys.hashkey \u6309 id \u505a\u5f02\u6b65\u8bb0\u5fc6\u5316&#xff08;app-asgi.py#L175-L181&#xff09;&#xff0c;\u5e76\u4f7f\u7528 db_conn.prepare(READ_ROW_SQL) \u9884\u7f16\u8bd1\u8bed\u53e5\u51cf\u5c11 SQL \u89e3\u6790\u5f00\u9500&#xff0c;\u53c2\u6570\u540d\u6539\u4e3a count\u3002<\/li>\n<\/ul>\n<p>\u6240\u6709 ASGI \u54cd\u5e94\u6d88\u606f\u5747\u9884\u5b9a\u4e49\u5e38\u91cf&#xff08;JSON_RESPONSE\u3001HTML_RESPONSE\u3001PLAINTEXT_RESPONSE&#xff09;&#xff0c;\u590d\u7528\u54cd\u5e94\u5934\u4ee5\u7701\u53bb\u91cd\u590d\u6784\u9020\u3002<\/p>\n<h4>ASGI \u5165\u53e3\u7684\u542f\u52a8\u65b9\u5f0f<\/h4>\n<p>\u4e0e WSGI \u7248\u76f8\u540c\u7684 fork \u591a\u8fdb\u7a0b\u6a21\u578b&#xff0c;\u4f46\u6bcf\u4e2a worker \u542f\u52a8\u524d\u5148 asyncio.get_event_loop().run_until_complete(db_setup()) \u5b8c\u6210\u8fde\u63a5\u6c60\u521d\u59cb\u5316&#xff08;app-asgi.py#L251-L281&#xff09;&#xff0c;\u968f\u540e\u540c\u6837\u8bbe\u7f6e backlog &#061; 4096 \u5e76\u8c03\u7528 fastpysgi.run(app, host, port, loglevel&#061;2)\u3002<\/p>\n<h3>\u6d4b\u8bd5\u6863\u4f4d\u914d\u7f6e&#xff1a;benchmark_config.json \u4e0e config.toml<\/h3>\n<p>benchmark_config.json \u5b9a\u4e49\u4e86 default&#xff08;WSGI&#xff09; \u4e0e asgi&#xff08;ASGI&#xff09; \u4e24\u4e2a\u6d4b\u8bd5\u6863\u4f4d&#xff0c;\u4e8c\u8005\u7684\u5173\u952e\u5dee\u5f02\u5982\u4e0b\u8868&#xff1a;<\/p>\n<table>\n<tr>\u914d\u7f6e\u9879default&#xff08;WSGI&#xff09;asgi&#xff08;ASGI&#xff09;<\/tr>\n<tbody>\n<tr>\n<td>\u6d4b\u8bd5\u8def\u5f84<\/td>\n<td>\/json\u3001\/plaintext<\/td>\n<td>\/json\u3001\/db\u3001\/queries?queries&#061;\u3001\/updates?queries&#061;\u3001\/cached-queries?count&#061;\u3001\/fortunes\u3001\/plaintext<\/td>\n<\/tr>\n<tr>\n<td>approach<\/td>\n<td>Realistic<\/td>\n<td>Realistic<\/td>\n<\/tr>\n<tr>\n<td>classification<\/td>\n<td>Micro<\/td>\n<td>Platform<\/td>\n<\/tr>\n<tr>\n<td>database<\/td>\n<td>None<\/td>\n<td>Postgres<\/td>\n<\/tr>\n<tr>\n<td>orm<\/td>\n<td>Raw<\/td>\n<td>Raw<\/td>\n<\/tr>\n<tr>\n<td>platform<\/td>\n<td>WSGI<\/td>\n<td>ASGI<\/td>\n<\/tr>\n<tr>\n<td>webserver<\/td>\n<td>FastPySGI<\/td>\n<td>FastPySGI<\/td>\n<\/tr>\n<tr>\n<td>display_name<\/td>\n<td>FastPySGI [WSGI]<\/td>\n<td>FastPySGI [ASGI]<\/td>\n<\/tr>\n<tr>\n<td>versus<\/td>\n<td>wsgi<\/td>\n<td>uvicorn<\/td>\n<\/tr>\n<tr>\n<td>port<\/td>\n<td>3000<\/td>\n<td>3000<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>versus \u5b57\u6bb5\u503c\u5f97\u5173\u6ce8&#xff1a;WSGI \u6863\u4f4d\u5c06\u540c\u4e3a Python 3 WSGI \u670d\u52a1\u5668\u7684 wsgi \u4f5c\u4e3a\u5bf9\u7167\u57fa\u7ebf&#xff0c;ASGI \u6863\u4f4d\u5219\u5c06 uvicorn \u4f5c\u4e3a\u5bf9\u7167\u57fa\u7ebf&#xff0c;\u8868\u660e FastPySGI \u7684\u76ee\u6807\u662f\u5206\u522b\u4e0e\u4e24\u7c7b\u670d\u52a1\u5668\u540c\u53f0\u7ade\u6280\u3002maintainers \u5b57\u6bb5\u767b\u8bb0\u4e86\u7ef4\u62a4\u8005 remittor&#xff08;\u5373 FastPySGI \u4e0a\u6e38\u4f5c\u8005&#xff09;\u3002<\/p>\n<p>\u4e0e JSON \u914d\u7f6e\u7b49\u4ef7\u7684 config.toml \u91c7\u7528 TOML \u8bed\u6cd5&#xff0c;\u5206\u4e3a [framework]\u3001[main]\u3001[asgi] \u4e09\u8282&#xff0c;\u5176\u4e2d [main] \u5bf9\u5e94 WSGI \u6863\u4f4d&#xff08;platform &#061; &#034;WSGI&#034;\u3001versus &#061; &#034;wsgi&#034;&#xff09;&#xff0c;[asgi] \u5bf9\u5e94 ASGI \u6863\u4f4d&#xff08;platform &#061; &#034;ASGI&#034;\u3001versus &#061; &#034;uvicorn&#034;&#xff09;\u3002\u4e24\u4efd\u914d\u7f6e\u540c\u65f6\u4fdd\u7559&#xff0c;\u4f9b\u6d4b\u8bd5\u5957\u4ef6\u6309\u9700\u9009\u7528\u3002<\/p>\n<h3>\u5bb9\u5668\u5316\u6784\u5efa\u4e0e\u4f9d\u8d56\u9501\u5b9a<\/h3>\n<p>\u4e24\u4e2a Dockerfile \u5747\u57fa\u4e8e python:3.11-bullseye \u955c\u50cf&#xff0c;\u6d41\u7a0b\u5b8c\u5168\u4e00\u81f4&#xff0c;\u4ec5\u542f\u52a8\u547d\u4ee4\u4e0d\u540c&#xff1a;<\/p>\n<ul>\n<li>fastpysgi.dockerfile&#xff1a;COPY requirements.txt .\/ \u540e\u5148 pip3 install -U pip&#xff0c;\u518d pip3 install &#8211;no-cache-dir -r requirements.txt \u65e0\u7f13\u5b58\u5b89\u88c5\u4f9d\u8d56&#xff0c;\u968f\u540e COPY . . \u62f7\u8d1d\u6e90\u7801&#xff0c;EXPOSE 3000 \u58f0\u660e\u7aef\u53e3&#xff0c;\u6700\u540e CMD python .\/app.py \u542f\u52a8 WSGI \u5e94\u7528&#xff1b;<\/li>\n<li>fastpysgi-asgi.dockerfile&#xff1a;\u9664 CMD python .\/app-asgi.py \u5916\u5176\u4f59\u6b65\u9aa4\u5b8c\u5168\u76f8\u540c\u3002<\/li>\n<\/ul>\n<p>requirements.txt \u9501\u5b9a\u4e86\u516d\u4e2a\u4f9d\u8d56\u53ca\u5176\u7cbe\u786e\u7248\u672c&#xff1a;<\/p>\n<p>fastpysgi&#061;&#061;0.2<br \/>\nujson&#061;&#061;5.12.0<br \/>\nasyncpg&#061;&#061;0.30.0<br \/>\njinja2&#061;&#061;3.1.6<br \/>\ncachetools&#061;&#061;5.3.0<br \/>\nasyncache&#061;&#061;0.3.1<\/p>\n<p>\u5176\u4e2d fastpysgi&#061;&#061;0.2 \u662f\u6838\u5fc3\u670d\u52a1\u5668\u672c\u4f53&#xff1b;asyncpg \u670d\u52a1\u4e8e ASGI \u6863\u4f4d\u7684 Postgres \u8fde\u63a5\u6c60&#xff1b;jinja2 \u670d\u52a1\u4e8e Fortune \u6a21\u677f\u6e32\u67d3&#xff1b;cachetools \u4e0e asyncache \u670d\u52a1\u4e8e \/cached-queries \u7684\u5f02\u6b65\u7f13\u5b58\u3002<\/p>\n<h3>\u6d4b\u8bd5\u5982\u4f55\u88ab\u5957\u4ef6\u6821\u9a8c<\/h3>\n<p>FastPySGI \u7684\u6bcf\u4e2a\u6d4b\u8bd5\u8def\u5f84\u90fd\u8981\u7ecf\u8fc7 toolset\/test_types \u4e0b\u5bf9\u5e94\u6d4b\u8bd5\u7c7b\u578b\u7684\u4e25\u683c\u6821\u9a8c&#xff0c;\u8fd9\u4e9b\u6821\u9a8c\u903b\u8f91\u6784\u6210\u4e86&#034;\u5b9e\u73b0\u5fc5\u987b\u5408\u89c4&#034;\u7684\u8fb9\u754c&#xff1a;<\/p>\n<ul>\n<li>JSON \u6d4b\u8bd5&#xff08;toolset\/test_types\/json\/json.py&#xff09;&#xff1a;\u54cd\u5e94\u4f53\u5fc5\u987b\u80fd\u53cd\u5e8f\u5217\u5316\u4e3a JSON&#xff0c;\u4e14\u5305\u542b\u503c\u4e3a hello, world!&#xff08;\u5927\u5c0f\u5199\u4e0d\u654f\u611f&#xff09;\u7684 message \u952e&#xff0c;\u540c\u65f6\u6821\u9a8c 200 OK \u72b6\u6001\u7801\u4e0e Content-Type: application\/json \u54cd\u5e94\u5934&#xff08;\u6b63\u5219 ^application\/json(; ?charset&#061;(UTF|utf)-8)?$&#xff0c;\u89c1 verifications.py#L104-L117&#xff09;&#xff1b;<\/li>\n<li>Plaintext \u6d4b\u8bd5&#xff08;toolset\/test_types\/plaintext\/plaintext.py&#xff09;&#xff1a;\u54cd\u5e94\u4f53\u5fc5\u987b\u5305\u542b hello, world!&#xff08;\u5927\u5c0f\u5199\u4e0d\u654f\u611f&#xff09;&#xff0c;\u5e76\u8b66\u544a\u8d85\u51fa\u5fc5\u8981\u5b57\u8282\u6570&#xff1b;<\/li>\n<li>db \/ query \/ update \/ cached-query \u6d4b\u8bd5&#xff1a;\u5747\u4f9d\u8d56 verify_randomnumber_object \/ verify_randomnumber_list \u6821\u9a8c id\u3001randomNumber \u952e\u4e0e\u6570\u503c\u8303\u56f4&#xff08;1&#xff5e;10000&#xff09;&#xff0c;query \u4e0e update \u8fd8\u4f1a\u901a\u8fc7 verify_query_cases \u4ee5 (&#039;2&#039;,&#039;fail&#039;), (&#039;0&#039;,&#039;fail&#039;), (&#039;foo&#039;,&#039;fail&#039;), (&#039;501&#039;,&#039;warn&#039;), (&#039;&#039;,&#039;fail&#039;) \u4e94\u7ec4\u7528\u4f8b\u9a8c\u8bc1\u53c2\u6570\u94b3\u5236\u884c\u4e3a&#xff08;query.py#L28-L30&#xff09;&#xff1b;<\/li>\n<li>Fortune \u6d4b\u8bd5&#xff08;toolset\/test_types\/fortune\/fortune.py&#xff09;&#xff1a;\u7528 FortuneHTMLParser \u89e3\u6790 HTML \u54cd\u5e94\u5e76\u4e0e\u5408\u6cd5\u8f93\u51fa\u9010\u884c diff&#xff0c;\u540c\u65f6\u6821\u9a8c\u67e5\u8be2\u6b21\u6570\u4e0e\u8bfb\u53d6\u884c\u6570&#xff08;12 \u884c \u00d7 \u8bf7\u6c42\u6570&#xff09;&#xff1b;<\/li>\n<li>\u67e5\u8be2\u6b21\u6570\u7edf\u8ba1&#xff1a;verify_queries_count&#xff08;verifications.py#L420-L469&#xff09;\u501f\u52a9 Postgres \u7684 pg_stat_statements \u6269\u5c55\u7edf\u8ba1\u5b9e\u9645\u6267\u884c\u7684 SQL \u6b21\u6570\u4e0e\u8bfb\u53d6\u884c\u6570&#xff08;\u5bf9\u5e94 postgres.py#L59-L68 \u4e2d\u7684 get_queries\/get_rows\/get_rows_updated&#xff09;&#xff0c;\u9632\u6b62\u6846\u67b6&#034;\u4f5c\u5f0a&#034;\u7ed5\u8fc7\u6570\u636e\u5e93\u8bfb\u53d6\u3002<\/li>\n<\/ul>\n<p>\u6570\u636e\u5e93\u4fa7\u7684\u6570\u636e\u6e90\u7531 create-postgres.sql \u63d0\u4f9b&#xff1a;World \u8868\u9884\u7f6e 10000 \u884c\u968f\u673a\u6570\u636e&#xff08;SELECT x.id, least(floor(random() * 10000 &#043; 1), 10000) FROM generate_series(1,10000)&#xff09;&#xff0c;Fortune \u8868\u9884\u7f6e 12 \u6761\u56fa\u5b9a\u8bed\u5f55\u3002\u8fd9\u6b63\u662f random.randint(1, 10000) \u53d6\u503c\u8303\u56f4\u4e0e worlds \u6821\u9a8c\u533a\u95f4 1&#xff5e;10000 \u7684\u6765\u6e90\u3002<\/p>\n<h3>\u672c\u5730\u9a8c\u8bc1\u4e0e\u8fd0\u884c<\/h3>\n<p>\u82e5\u8981\u9a8c\u8bc1 FastPySGI \u6d4b\u8bd5\u5b9e\u73b0\u662f\u5426\u6b63\u786e&#xff0c;\u53ef\u53c2\u8003 toolset\/scaffolding\/README.md \u4e2d\u63cf\u8ff0\u7684\u6807\u51c6\u6d41\u7a0b&#xff0c;\u5728\u4ed3\u5e93\u6839\u76ee\u5f55\u6267\u884c&#xff1a;<\/p>\n<p>$ tfb &#8211;mode verify &#8211;test fastpysgi<\/p>\n<p>\u8be5\u547d\u4ee4\u4f1a\u4ee5 verify \u6a21\u5f0f\u8fd0\u884c\u5957\u4ef6&#xff0c;\u4e0d\u91c7\u96c6\u6027\u80fd\u6570\u636e&#xff0c;\u4ec5\u6d4b\u8bd5\u80fd\u5426\u547d\u4e2d benchmark_config.json \u4e2d\u58f0\u660e\u7684\u7aef\u70b9\u4e14\u54cd\u5e94\u5185\u5bb9\u6b63\u786e\u3002\u9700\u8981\u6ce8\u610f\u7684\u9002\u7528\u524d\u63d0&#xff1a;app-asgi.py \u4f9d\u8d56 tfb-database \u4e3b\u673a\u540d\u4e0e benchmarkdbuser\/benchmarkdbpass \u51ed\u636e&#xff0c;\u56e0\u6b64 ASGI \u6863\u4f4d\u7684\u9a8c\u8bc1\u9700\u8981\u5957\u4ef6\u62c9\u8d77 Postgres \u6570\u636e\u5e93\u5bb9\u5668&#xff1b;\u800c WSGI \u6863\u4f4d&#xff08;\/json\u3001\/plaintext&#xff09;\u65e0\u6570\u636e\u5e93\u4f9d\u8d56&#xff0c;\u53ef\u4ee5\u72ec\u7acb\u8fd0\u884c\u3002\u624b\u52a8\u672c\u5730\u8fd0\u884c\u5219\u53ef\u76f4\u63a5\u6267\u884c&#xff1a;<\/p>\n<p>python .\/app.py          # WSGI \u7248&#xff0c;\u76d1\u542c 0.0.0.0:3000<br \/>\npython .\/app-asgi.py     # ASGI \u7248&#xff0c;\u9700\u5148\u4fdd\u8bc1 Postgres \u53ef\u8fbe<\/p>\n<p>\u4e24\u4e2a\u5165\u53e3\u90fd\u652f\u6301\u901a\u8fc7\u73af\u5883\u53d8\u91cf TRAVIS&#061;true \u5c06 worker \u6570\u94b3\u5236\u4e3a 2&#xff0c;\u4fbf\u4e8e\u5728 CI \u73af\u5883\u5feb\u901f\u5192\u70df\u6d4b\u8bd5\u3002<\/p>\n<h3>\u5c0f\u7ed3<\/h3>\n<p>\u4ece\u8fd9\u4e00\u4efd\u77ed\u77ed\u6570\u884c\u7684 README \u51fa\u53d1&#xff0c;\u53ef\u4ee5\u5b8c\u6574\u8fd8\u539f FastPySGI \u6d4b\u8bd5\u7684\u5168\u8c8c&#xff1a;libuv &#043; llhttp \u63d0\u4f9b\u539f\u751f\u5f02\u6b65 I\/O \u4e0e HTTP \u89e3\u6790&#xff0c;WSGI\/ASGI \u53cc\u6d88\u8d39\u8005\u63a5\u53e3\u8ba9\u540c\u4e00\u670d\u52a1\u5668\u53ef\u4ee5\u627f\u8f7d\u4f20\u7edf\u4e0e\u5f02\u6b65\u4e24\u7c7b Python \u5e94\u7528\u3002\u4ed3\u5e93\u4e2d app.py \u7684\u6781\u7b80\u8def\u7531\u4e0e fork \u591a\u8fdb\u7a0b\u6a21\u578b\u3001app-asgi.py \u7684 asyncpg \u8fde\u63a5\u6c60\u4e0e\u5f02\u6b65\u7f13\u5b58\u67e5\u8be2\u3001benchmark_config.json \u4e0e config.toml \u7684\u53cc\u6863\u4f4d\u914d\u7f6e\u3001\u4ee5\u53ca toolset \u4e2d\u5c42\u5c42\u9012\u8fdb\u7684\u54cd\u5e94\u6821\u9a8c\u4e0e\u67e5\u8be2\u8ba1\u6570\u673a\u5236&#xff0c;\u5171\u540c\u6784\u6210\u4e86\u4e00\u6761\u4ece&#034;\u670d\u52a1\u5668\u539f\u7406&#034;\u5230&#034;\u57fa\u51c6\u9a8c\u8bc1&#034;\u7684\u5b8c\u6574\u94fe\u8def&#xff0c;\u4e5f\u4e3a\u5728 FrameworkBenchmarks \u4e2d\u65b0\u589e\u7c7b\u4f3c\u8f7b\u91cf\u7ea7 Python \u670d\u52a1\u5668\u7684\u5b9e\u73b0\u63d0\u4f9b\u4e86\u53ef\u590d\u7528\u7684\u53c2\u7167\u6a21\u677f\u3002<\/p>\n<p>  <img loading=\"lazy\" decoding=\"async\" class=\"gcb-icon-like\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261105114905-6aec6d312232d.svg\" alt=\"\" width=\"16\" height=\"16\" \/> <span class=\"gcb-like-text\">\u8d5e<\/span>  <\/p>\n<p>   <span class=\"gcb-share-text\">\u5206\u4eab<\/span>  <\/p>\n<ul class=\"gcb-tag-list\">\n<li><span class=\"gcb-tag\">\u6027\u80fd\u6d4b\u8bd5<\/span><\/li>\n<li><span class=\"gcb-tag\">\u6d4b\u8bd5<\/span><\/li>\n<li><span class=\"gcb-tag\">\u540e\u7aef<\/span><\/li>\n<li><span class=\"gcb-tag\">\u5f00\u53d1\u8005\u5de5\u5177<\/span><\/li>\n<\/ul>\n<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011FrameworkBenchmarks<\/h3>\n<p class=\"gcb-project-desc\">Source for the TechEmpower Framework Benchmarks project<\/p>\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/gh_mirrors\/fr\/FrameworkBenchmarks<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<h4 class=\"gcb-related-title\">\u76f8\u5173\u63a8\u8350<\/h4>\n<ul class=\"gcb-related-list\">\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">Falcon \u5728 TechEmpower Framework Benchmarks \u4e2d\u7684 WSGI\/ASGI \u57fa\u51c6\u6d4b\u8bd5\u5b9e\u73b0\u89e3\u6790<\/h5>\n<p class=\"gcb-related-item-desc\">Falcon \u5728 TechEmpower Framework Benchmarks \u4e2d\u7684 WSGI\/ASGI \u57fa\u51c6\u6d4b\u8bd5\u5b9e\u73b0\u89e3\u6790 \u672c\u6587\u4ee5 frameworks\/P<\/p>\n<p>     <span class=\"gcb-tag\">\u6027\u80fd\u6d4b\u8bd5<\/span><br \/>\n     <span class=\"gcb-tag\">\u6d4b\u8bd5<\/span><br \/>\n     <span class=\"gcb-tag\">\u540e\u7aef<\/span><br \/>\n     <span class=\"gcb-tag\">\u5f00\u53d1\u8005\u5de5\u5177<\/span>\n      <\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">Falcon Web Framework \u5b9e\u6218\u6307\u5357&#xff1a;\u57fa\u4e8e ASGI\/WSGI \u6784\u5efa\u9ad8\u6027\u80fd REST API \u4e0e\u5fae\u670d\u52a1<\/h5>\n<p class=\"gcb-related-item-desc\">Falcon Web Framework \u5b9e\u6218\u6307\u5357&#xff1a;\u57fa\u4e8e ASGI\/WSGI \u6784\u5efa\u9ad8\u6027\u80fd REST API \u4e0e\u5fae\u670d\u52a1 Falcon \u662f\u4e00\u4e2a\u4ee5&#034;\u6781\u7b80\u3001\u65e0\u9b54\u6cd5&#xff08;no<\/p>\n<p>     <span class=\"gcb-tag\">\u540e\u7aef<\/span><br \/>\n     <span class=\"gcb-tag\">Web\u6846\u67b6<\/span><br \/>\n     <span class=\"gcb-tag\">API\u8bbe\u8ba1<\/span>\n      <\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">gevent \u57fa\u4e8e Unix Domain Socket \u7684 WSGI \u670d\u52a1\u5668\u5b9e\u6218&#xff1a;unixsocket_server.py \u6df1\u5ea6\u89e3\u6790<\/h5>\n<p class=\"gcb-related-item-desc\">gevent \u57fa\u4e8e Unix Domain Socket \u7684 WSGI \u670d\u52a1\u5668\u5b9e\u6218&#xff1a;unixsocket_server.py \u6df1\u5ea6\u89e3\u6790 \u672c\u6307\u5357\u4ee5 gevent <\/p>\n<p>     <span class=\"gcb-tag\">\u540e\u7aef<\/span>\n      <\/li>\n<\/ul>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0a\u4e00\u7bc7&#xff1a;<\/span><br \/>\n   BioGPT\u5b8c\u6574\u6559\u7a0b&#xff1a;\u751f\u7269\u533b\u5b66AI\u7684\u5165\u95e8\u5230\u7cbe\u901a\u6307\u5357 <\/p>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0b\u4e00\u7bc7&#xff1a;<\/span><br \/>\n   ADBKeyBoard\u5b8c\u5168\u6307\u5357&#xff1a;5\u5206\u949f\u641e\u5b9aAndroid\u81ea\u52a8\u5316\u4e2d\u6587\u8f93\u5165 <\/p>\n<p>\u521b\u4f5c\u58f0\u660e\uff1a\u672c\u6587\u90e8\u5206\u5185\u5bb9\u7531AI\u8f85\u52a9\u751f\u6210\uff08AIGC\uff09\uff0c\u4ec5\u4f9b\u53c2\u8003<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6027\u80fd\u6d4b\u8bd5\u6d4b\u8bd5\u540e\u7aef\u5f00\u53d1\u8005\u5de5\u5177 \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011FrameworkBenchmarks Source for the TechEmpower Framework Benchmarks project \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/gh_mirrors\/fr\/FrameworkBenchmarks \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d  \u672c\u6307\u5357\u4ee5 FrameworkBenchmarks \u4ed3\u5e93\u4e2d FastPySGI \u6d4b\u8bd5\u76ee\u5f55 \u4e3a\u84dd\u672c&#xff0c;\u7cfb\u7edf\u8bb2\u89e3 Fast<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-122826","post","type-post","status-publish","format-standard","hentry","category-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>FastPySGI \u57fa\u51c6\u6d4b\u8bd5\u5b9e\u73b0\u89e3\u6790\uff1a\u57fa\u4e8e libuv \u4e0e llhttp \u7684 Python WSGI\/ASGI \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\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.wsisp.com\/helps\/122826.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FastPySGI \u57fa\u51c6\u6d4b\u8bd5\u5b9e\u73b0\u89e3\u6790\uff1a\u57fa\u4e8e libuv \u4e0e llhttp \u7684 Python WSGI\/ASGI \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6027\u80fd\u6d4b\u8bd5\u6d4b\u8bd5\u540e\u7aef\u5f00\u53d1\u8005\u5de5\u5177 \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011FrameworkBenchmarks Source for the TechEmpower Framework Benchmarks project \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/gh_mirrors\/fr\/FrameworkBenchmarks \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d \u672c\u6307\u5357\u4ee5 FrameworkBenchmarks \u4ed3\u5e93\u4e2d FastPySGI \u6d4b\u8bd5\u76ee\u5f55 \u4e3a\u84dd\u672c&#xff0c;\u7cfb\u7edf\u8bb2\u89e3 Fast\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/122826.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-05T11:49:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261105114905-6aec6d312232d.svg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/122826.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/122826.html\",\"name\":\"FastPySGI \u57fa\u51c6\u6d4b\u8bd5\u5b9e\u73b0\u89e3\u6790\uff1a\u57fa\u4e8e libuv \u4e0e llhttp \u7684 Python WSGI\/ASGI \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-11-05T11:49:06+00:00\",\"dateModified\":\"2026-11-05T11:49:06+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/122826.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/122826.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/122826.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FastPySGI \u57fa\u51c6\u6d4b\u8bd5\u5b9e\u73b0\u89e3\u6790\uff1a\u57fa\u4e8e libuv \u4e0e llhttp \u7684 Python WSGI\/ASGI \u670d\u52a1\u5668\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"FastPySGI \u57fa\u51c6\u6d4b\u8bd5\u5b9e\u73b0\u89e3\u6790\uff1a\u57fa\u4e8e libuv \u4e0e llhttp \u7684 Python WSGI\/ASGI \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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.wsisp.com\/helps\/122826.html","og_locale":"zh_CN","og_type":"article","og_title":"FastPySGI \u57fa\u51c6\u6d4b\u8bd5\u5b9e\u73b0\u89e3\u6790\uff1a\u57fa\u4e8e libuv \u4e0e llhttp \u7684 Python WSGI\/ASGI \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6027\u80fd\u6d4b\u8bd5\u6d4b\u8bd5\u540e\u7aef\u5f00\u53d1\u8005\u5de5\u5177 \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011FrameworkBenchmarks Source for the TechEmpower Framework Benchmarks project \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/gh_mirrors\/fr\/FrameworkBenchmarks \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d \u672c\u6307\u5357\u4ee5 FrameworkBenchmarks \u4ed3\u5e93\u4e2d FastPySGI \u6d4b\u8bd5\u76ee\u5f55 \u4e3a\u84dd\u672c&#xff0c;\u7cfb\u7edf\u8bb2\u89e3 Fast","og_url":"https:\/\/www.wsisp.com\/helps\/122826.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-11-05T11:49:06+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261105114905-6aec6d312232d.svg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/122826.html","url":"https:\/\/www.wsisp.com\/helps\/122826.html","name":"FastPySGI \u57fa\u51c6\u6d4b\u8bd5\u5b9e\u73b0\u89e3\u6790\uff1a\u57fa\u4e8e libuv \u4e0e llhttp \u7684 Python WSGI\/ASGI \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-11-05T11:49:06+00:00","dateModified":"2026-11-05T11:49:06+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/122826.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/122826.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/122826.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"FastPySGI \u57fa\u51c6\u6d4b\u8bd5\u5b9e\u73b0\u89e3\u6790\uff1a\u57fa\u4e8e libuv \u4e0e llhttp \u7684 Python WSGI\/ASGI \u670d\u52a1\u5668"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/122826","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=122826"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/122826\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=122826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=122826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=122826"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=122826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}