我们有一个连接到 GCSQL 的谷歌应用引擎应用程序,并且在尝试连接数据库时遇到了很多 DeadlineExceededError 问题。该错误似乎是由大量用户在短时间内打开应用程序产生的。当我们在此期间在仪表板上查找打开的连接时,同时打开的连接不超过 45 个,并且在很大比例的查询(读取、写入和连接)上都失败了,花费了太多时间来做它。由于花费的时间,服务关闭并且我们收到错误。
错误示例:
Traceback (most recent call last):
File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 223, in Handle
result = handler(dict(self._environ), self._StartResponse)
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~ono-hat-prod/1.365115032772094991/onohatpreprod.py", line 5541, in post
cursor.execute("SELECT %s FROM actuaciones WHERE numero = '%s' " % (rc,idHat))
File "/python27_runtime/python27_lib/versions/1/google/storage/speckle/python/api/rdbms.py", line 499, in execute
self._DoExec(request)
File "/python27_runtime/python27_lib/versions/1/google/storage/speckle/python/api/rdbms.py", line 375, in _DoExec
response = self._conn.MakeRequest('Exec', request)
File "/python27_runtime/python27_lib/versions/1/google/storage/speckle/python/api/rdbms.py", line 873, in MakeRequest
response = self._MakeRetriableRequest(stub_method, request)
File "/python27_runtime/python27_lib/versions/1/google/storage/speckle/python/api/rdbms.py", line 897, in _MakeRetriableRequest
response = self.MakeRequestImpl(stub_method, request)
File "/python27_runtime/python27_lib/versions/1/google/storage/speckle/python/api/rdbms_apiproxy.py", line 67, in MakeRequestImpl
except apiproxy_errors.ApplicationError, e:
DeadlineExceededError
一段代码,直到发生错误:
class detalleActuacion(webapp2.RequestHandler):
def post(self):
idHat = self.request.get('id')
logging.info(idHat)
num_conexiones = 0
num_cierres = 0
conn = rdbms.connect(instance=_INSTANCE_NAME, database='Actuaciones')
num_conexiones = num_conexiones + 1
cursor = conn.cursor()
dict_act = {}
request_cad = 'solucionado,duracion,numero,fecha_inicio_ventana,fecha_fin_ventana,'
request_cad = request_cad+'tipo,titulo,tipo_cliente,ubicacion,zona_regional,'
request_cad = request_cad+'zona_local,ciudad_ticket,zona_regional_subticket,zona_local_subticket,'
request_cad = request_cad+'zona_local_ticket,skill,num_recursos,num_actuaciones,ubi_emplaz,'
request_cad = request_cad+'ubi_provincia,ubi_lat,ubi_long,ubi_via,ubi_calle,ubi_numero,ubi_adic,'
request_cad = request_cad+'ubi_CP,miga_terminal,miga_tlf,miga_dir,severidad,prioridad,serv_CATV,'
request_cad = request_cad+'serv_datos,serv_DTV,serv_empresa,serv_telefonia,instr,num_rep,'
rc = request_cad+'fecha_creac,fecha_creac_tp,fecha_sol,fecha_sol_tp,fecha_cierre,fecha_cierre_tp,'
rc = rc+'fecha_inicio,fecha_fin,descr_adic,descr_log,grupo_pos,accion,cola,estado,estado_ticket,'
rc=rc+'doc_adj,detalle_equipos,tarea,subtarea,subzona,TIR,elem_red,descripcion,num_afectados,'
rc=rc+'repeticion,fecha_repeticion,dias_repeticion,dias_semana,fin_repeticion,cl_afectados,'
rc=rc+'plan_tp,marca_seguimiento,tipificacion,miga,zona,bandeja,alerta,descr_log1,descr_log2,descr_log3,descr_log4,descr_log5,descr_log6,descr_log7,descr_log8,descr_log9,'
rc=rc+'elem_red_2,estado_CRM,tecnico,tecnico2,tecnico3,tecnico4,tecnico5,num_asignaciones,ultima_modificacion,tiempo_proceso,fecha_inicio_real,fecha_fin_real'
rc=rc+',observaciones1,observaciones2,observaciones3,observaciones4,observaciones5,observaciones6,observaciones7,observaciones8,observaciones9,observaciones10'
cursor = conn.cursor()
cursor.execute("SELECT %s FROM actuaciones WHERE numero = '%s' " % (rc,idHat))
预先感谢您的协助。