After deployment look at the flask supported concurrency, to a 300 concurrency look, on the code
Import threading, time, Requestsurl = "" total = 0suc = 0fail = 0exception = 0maxtime=0mintime=100gt3=0lt3=0class requestth Read (threading. Thread):d EF __init__ (Self, thread_name): Threading. Thread.__init__ (self) self.test_count = 0def Run (self): Self.test_performace () def test_performace (self): Global Totalglobal Sucglobal failglobal exceptionglobal gt3global lt3try:st = Time.time () conn = requests.get (URL) res = Conn.status_codeif res== 200:total+=1suc+=1else: Total+=1fail+=1time_span = Time.time ()-st print ('%s:%f\n '% (self.name,time_span)) self.ma Xtime (Time_span) self.mintime (Time_span) if Time_span>3:gt3+=1else: Lt3+=1except Exception as E:print (e) total+=1exception+=1def maxtime (self,ts): Global MAXTIMEPR int (TS) if Ts>maxtime:maxtime=tsdef mintime (self,ts): Global Mintimeif Ts<mintime:mintime=tsprint (' =========== request start =========== ') start_time = Time.time () Thread_count = 100i = 0 while I <= thread_count:t = Requestthread ("Thread:" + str (i)) T.start () i + = 1 t=0w Hile total<thread_count|t>20:print ("Total:%d, number of successes:%d, failure:%d, exception:%d\n"% (total,suc,fail,exception)) print (URL) t+= 1time.sleep (1) print (' ===========task end=========== ') print ("Total:%d, success:%d, failed:%d, exception:%d"% (total,suc,fail,exception) Print (' Response max time: ', maxtime) print (' Response min. ', mintime) print (' response greater than 3 seconds:%d,%:%0.2f '% (gt3,float (GT3)/total)) print (' less than 3 seconds :%d,%:%0.2f '% (lt3,float (LT3)/total))
Look at the Baidu request response
Well, what about mine?
It is OK to support the concurrency, but not very accurate, you can refer to. The interface can also be used to