Contenu connexe Similaire à как мы сделали поисковой движок (6) Plus de Антон Плешивцев (10) как мы сделали поисковой движок13. ПОИСК V1.0
• 30 минут на деплой
• 350mb на процесс
• 30сек на старт приложения
14. ПОИСК V1.0
• 30 минут на деплой
• 350mb на процесс
• 30сек на старт приложения
• Блокирующий i/o
18. – Paul Graham
«When I see patterns in my programs, I consider it a
sign of trouble.The shape of a program should reflect
only the problem it needs to solve.Any other
regularity in the code is a sign, to me at least, that I’m
using abstractions that aren’t powerful enough…».
35. INTERNAL DSL
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
#Your restart mechanism here, for example:
execute :touch, release_path.join('tmp/restart.txt')
end
end
end
36. EXTERNAL DSL
server {
listen 80;
client_max_body_size 16M;
root /home/aviasales/woodpecker/current/public;
charset utf-8;
!
location / {
try_files $uri/index.html $uri @app;
}
!
location @app {
proxy_set_header Client-Ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_pass http://app;
}
}
37. EXTERNAL JSON DSL
"s": [
"qatar_supported_directions",
"qatar_jetradar_ruler",
"qatar_throttler",
"qatar_special_ticket_mark",
"time_zones_extender",
"drop_bad_tickets",
"merge",
"gate_productivity_extender",
"airlines_extender",
"deeplinks_extender",
"airline_deeplinks_extender_db",
"order_urls_collector",
"result"
]
45. АСИНХРОННЫЙ IO В
TORNADOV1.0
class AsyncHandler(RequestHandler):
@asynchronous
def get(self):
http_client = AsyncHTTPClient()
http_client.fetch("http://example.com",
callback=self.on_fetch)
!
def on_fetch(self, response):
do_something_with_response(response)
self.render("template.html")
46. АСИНХРОННЫЙ IO В
TORNADOV2.0
class GenAsyncHandler(RequestHandler):
@gen.coroutine
def get(self):
http_client = AsyncHTTPClient()
response = yield http_client.fetch("http://example.com")
do_something_with_response(response)
self.render("template.html")
56. RESULTS
• 250 мб на процесс
• до 10 одновременных запросов
• 500 одновременных соединений
• все данные внутри процесса