Today I just wanted to know which of these options is faster:
- Go HTTP standalone
- Nginx proxy to Go HTTP
- Nginx fastcgi to Go TCP FastCGI
- Nginx fastcgi to Go Unix Socket FastCGI
| data:text/html, | |
| <style type="text/css"> | |
| #e { | |
| position:absolute; | |
| top:0; | |
| right:0; | |
| bottom:0; | |
| left:0; | |
| font-size:16px; | |
| } |
| from time import sleep | |
| import tornado | |
| from multiprocessing.pool import ThreadPool | |
| _workers = ThreadPool(10) | |
| class BackgroundMix(tornado.web.RequestHandler): | |
| """将block任务放入线程池中执行 | |
| EXAMPLE: | |
| # blocking task like querying to MySQL |
| # | |
| # Test of experimental Tornado feature for a streaming request body handler, see | |
| # https://github.com/nephics/tornado/commit/1bd964488926aac9ef6b52170d5bec76b36df8a6 | |
| # | |
| # | |
| # Client sending file to server | |
| # | |
| import tornado.httpclient as httpclient |
| #!/usr/bin/env python | |
| # | |
| # Converts any integer into a base [BASE] number. I have chosen 62 | |
| # as it is meant to represent the integers using all the alphanumeric | |
| # characters, [no special characters] = {0..9}, {A..Z}, {a..z} | |
| # | |
| # I plan on using this to shorten the representation of possibly long ids, | |
| # a la url shortenters | |
| # |
| <html> | |
| <head> | |
| <title>Look at WebSQL</title> | |
| <script> | |
| // Through the code below remember essentialy there are just 3 core methods we tend to use | |
| // openDatabase | |
| // transaction | |
| // executeSql | |
| // Opening a connection |
| var pubsub = {}; | |
| (function(q) { | |
| var topics = {}, subUid = -1; | |
| q.subscribe = function(topic, func) { | |
| if (!topics[topic]) { | |
| topics[topic] = []; | |
| } | |
| var token = (++subUid).toString(); | |
| topics[topic].push({ | |
| token: token, |
| var pubsub = {}; | |
| (function(q) { | |
| var topics = {}, subUid = -1; | |
| q.subscribe = function(topic, func) { | |
| if (!topics[topic]) { | |
| topics[topic] = []; | |
| } | |
| var token = (++subUid).toString(); | |
| topics[topic].push({ | |
| token: token, |
| /* http://stackoverflow.com/questions/21968531/how-to-draw-a-checkmark-tick-using-css */ | |
| #checkmark { | |
| display:inline-block; | |
| width: 22px; | |
| height:22px; | |
| -ms-transform: rotate(45deg); /* IE 9 */ | |
| -webkit-transform: rotate(45deg); /* Chrome, Safari, Opera */ | |
| transform: rotate(45deg); | |
| } |
| /* iPhone6 portrait */ | |
| @media screen { | |
| @media (device-width: 375px) { | |
| @media (device-height: 667px) { | |
| @media (orientation: portrait) { | |
| @media (-webkit-min-device-pixel-ratio: 2) { | |
| /* define style here*/ | |
| } | |
| } | |
| } |