In linux, normally, it is impossible to "bind()" to the same TCP port twice. If you try to bind to the same port from second proces unix processes you'll see:
socket.error: [Errno 98] Address already in use
| ּ_בּ | |
| בּ_בּ | |
| טּ_טּ | |
| כּ‗כּ | |
| לּ_לּ | |
| מּ_מּ | |
| סּ_סּ | |
| תּ_תּ | |
| ٩(×̯×)۶ | |
| ٩(̾●̮̮̃̾•̃̾)۶ |
| import os | |
| import itertools | |
| CHUNK_SIZE = 100 | |
| def read_lines_backwards(filename): | |
| f = file(filename, 'rb') | |
| f.seek(0, os.SEEK_END) | |
| left = '' |
| import os, sys, socket, passfd | |
| import tornado.httpserver | |
| import tornado.ioloop | |
| import tornado.web | |
| import time | |
| class HelloHandler(tornado.web.RequestHandler): | |
| def get(self): | |
| self.write('hello from pid: %s' % os.getpid()) |
| """Tool for profiling Cassandra query performance. | |
| Tests are run by profile() multiple times and the 'Read Latency' is | |
| extracted using node tool. | |
| Usage: | |
| #Create the schema using the cassandra-cli. | |
| create keyspace query |
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| """ | |
| Changes the format specifier on SSTables **IN PLACE** | |
| e.g. change | |
| TwitterUserHistoricalValues-h-20983-Data.db | |
| to be | |
| TwitterUserHistoricalValues-g-20983-Data.db |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| package systemd | |
| import ( | |
| "os" | |
| "strconv" | |
| "syscall" | |
| ) | |
| const ( | |
| listenFdsStart = 3 |
| // Support routines for automatically reporting user timing for common analytics platforms | |
| // Currently supports Google Analytics, Boomerang and SOASTA mPulse | |
| // In the case of boomerang, you will need to map the event names you want reported | |
| // to timer names (for mPulse these need to be custom0, custom1, etc) using a global variable: | |
| // rumMapping = {'aft': 'custom0'}; | |
| (function() { | |
| var wtt = function(n, t, b) { | |
| t = Math.round(t); | |
| if (t >= 0 && t < 3600000) { | |
| // Google Analytics |
A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."