Go vs Python. Vitaly Levchenko

Proponho a leitura da transcrição do relatório Vitaly Levchenko Go vs Python


Go é uma palavra mágica, resolvendo todos os problemas de produção de uma só vez e ao mesmo tempo tecnologia inútil sem execuções. A verdade está no meio, então vamos falar sobre exemplos específicos:


  • asyncio vs goroutines;
  • desempenho de gargalo;
  • concisão versus simplicidade de código;
  • limiar de entrada;
  • ajuste e padrões de busca de problemas e otimização de desempenho;
  • serviço em produção.



Go, Go 2012 , Python . , , . Go , - « Go». , .


, ? Go 2012 , Go MeetUp’ 2014, .



, – .


. , : « , http, , , ». . , http. , techempower.com/benchmarks/. http -, 16 , http.



, 14 , .



. , 329 000 Go http, http 180 000 . , .



Python . 65 – 70 , , .



django, . , , 5 , 5-6 http, django , Twisted .



latency, . , . . 100 , , .



, Python latency, .. 7 . django.



Latency django , Go. , 14 , 28 2 , (2ms 14,000req/s = 28 cores 1). Django . , , .



, , , - , , . , ? , redis . , 10 000 100 , , , , 10 1000 - . json - 20 , 10 .



redis , , Python 200 . . , 10 . – . , Go , Go , « », , , , .



multiprocessing Python. , , 2 , . — 2 . , , , dict-update - .



, . , , , 10 , , 28 280 . Python. - - , Python .



: - 28 , multiprocessing . , , , - . , redis 0,2 . Manager.Value - , .. . Prometheus mmap merged . , . mmap mutex merged. , .



Python 2018 Async/Await.



. , , Go. , TopFace, - , , , . , . , - .


, 14 . , , ?


, , . 100-150-200, , , , goroutine . , , , , 200 -. goroutine, .


goroutine ? 200 , - , 100 , 14, - ? goroutine, , , goroutine, thread . goroutine - . Go . . . 3.7, .



, Go, scheduler. . syscall goroutine scheduler , , scheduler, syscall . 14 , 14 goroutine, syscall, , . , , .. - goroutine, - , , , -, , , , .


mutex , , , .



Asyncio . , , Scheduler, - kqueue, epoll. , , , Go. Async/Await - .



, . . Async/Await. , - . , , . runtime , .



, Asyncio . aio-libs, 11 . , , , - Close, . production Aerospike, . . - , , , , - .



Python thread. Go . Go. goroutine, - , : « ». , Graceful shutdown. , . Python , http, net . . - . , . Go , , , , .



, Select Go , 5 . , 5 , 5 , -, -. Python queue, , , , . Go , .



, , Python Go. : « DataScience, , ».



DataScience, , , DataScience .



Go . - . , - , , , -, , , .


, , , , Python, .



, . , SiKit — . , , , . . , . Sikit. Surprise , SVD. 2 , SVD, 2 SVD++, , , 3 . , Go SVD++?



2 . , , enterprise, , . , AVX2 20% SVD. , , , Go , Spark Go. .



, Go , , . Go, . , , . 2 10 , - .



Go . pprof http. pprof.



, , , - syscall . : « Garbage Collector» « mutex», « ».


pprof list func. .


disasm , .



. .



FlameGraph, Python .



, , , .



gcflag -S .


gcflag -m pprof Inline .


C . , . , - , 8% , 8% 10% .


2 . Go , Go . : « http c , », . , , , .



Pprof , , mutex, stacktrace, tracing . , , 5 . , , - , .



build-race — , . , , . Build-race race conditions, 4 , , .


, , , GC.



, .



Go , , , Go, 1.0 1.1, 1.1 1.2, 1.2 1.3 , 1.11 1.12, , , , . 2012 .


, . , . go get Go , . . , . , - , , . , .


, /. . . , .



, , Python, 3.6 3.7 . , - QT .


Python , , , .


, , .



Go , Python, , , - , .


, . . , Mac, Windows, Linux - , . 5 .


Golang 1.12 Go Mod . . go install. go.mod go get. pip freeze . , pip freeze.


. virtualenv, , - node_modules. Python , , .


Golang , . , -, .


Go - runtime: GC , , GC , , GC , - . .



Go. , , , . godoc.org .


, , , PR , . PR , go install .


- . , -, , .



, Go, , .



godoc -http=:6060 Go . . , 10 , - pydoc sphinx. godoc, , .



. , Go Exception? , panic.



, , , , , . , Exception? . Excepton , . . - -.



Go . , , . http get. , , - .



. , . 500 http code. http . http code 500 , 400 . , . Excepton , , .



. , , , .



. , Go UTF-8, Python 3.7 UTF-8, / .



, , Python, Ruby, elixir, Go, Java. C++, .



– . , " " 2018 . , 75 Python 150 , 90% – 185 . "Get It" . , Senior Python 175 – 200 .


StackOverFlow, 100 , 98 Python.



Go . " " 180 – 225 , "Get It" 205 – 250 , StackOverFlow 110 . + 20% , Go.



Python , . Data science , , .



, latency , , . , Go . , , .


Go , operation. / production . , .


Go ? .



: ?


: Python. , http. PyPy . . - , - .


: Python Go, - Python - ?


: , . . , , , , 90%, 80% , 10% . , . . .


Go . -. . go . , , . .


: , Go?


: . . , , , OpenSource. Go 2014 : Prometheus, influxdb, docker, Kubernetes. , , DropBox CloudFleer, Go. OpenSource Go .


: , , " ", , Scala Elixir , , , Go?


: 2018 Go . , , , , , Go .


: , . . . . , , 90% . . Go, . . . , , Python, , stackstrace Sentry, , , . . , , . ?


: . . , . , , . , Exception.


. , , .


: - , ?


: . . , , .


P.S. :


golang — Go,


Golang RU — Golang


Golang Jobs and Freelance - Empregos e freelancers para desenvolvedores golang


All Articles