5
私はWSGI要求と応答を実装しているボトルフレームワークを使用していますが、シングルスレッドの問題のためにサーバーをPythonWSGIServerに変更してApacheベンチでテストしました。この質問How to prevent errno 32 broken pipe?と同様です。 私は答えを試みたが役に立たなかった。ボトルフレームワークを使用したPythonペースト壊れたパイプエラー
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/paste/httpserver.py", line 1068, in process_request_in_thread
self.finish_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 641, in __init__
self.finish()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 694, in finish
self.wfile.flush()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
サーバコードは以下のとおりですが、スレッドプールを使用して接続を改善する方法はわかりません。
from paste import httpserver
@route('/')
def index():
connection = pymongo.MongoClient(connectionString)
db = connection.test
collection = db.test
return str(collection.find_one())
application = default_app()
httpserver.serve(application, host='127.0.0.1', port=8082)