أقترح قراءة نص تقرير فيتالي ليفتشينكو غو ضد بايثون
Go هي كلمة سحرية ، تحل جميع مشاكل الإنتاج في وقت واحد وفي نفس الوقت تقنية غير مجدية دون تنفيذ. الحقيقة في المنتصف ، لذلك دعونا نتحدث عن أمثلة محددة:
- asyncio مقابل goroutines.
- أداء عنق الزجاجة ؛
- الإيجاز مقابل بساطة الكود ؛
- عتبة الدخول
- الضبط وأنماط البحث عن المشاكل وتحسين الأداء ؛
- الخدمة في الإنتاج.
![](https://habrastorage.org/webt/4d/wr/vf/4dwrvfvdawsbws2m8mf2qusiaqc.png)
Go, Go 2012 , Python . , , . Go , - « Go». , .
, ? Go 2012 , Go MeetUp’ 2014, .
![](https://habrastorage.org/webt/gq/za/_n/gqza_n8d5n-gbqbyvjo9tj601s4.png)
, – .
. , : « , http, , , ». . , http. , techempower.com/benchmarks/. http -, 16 , http.
![](https://habrastorage.org/webt/ua/kl/_q/uakl_q8xgt4w3u-_snzndnps94m.png)
, 14 , .
![](https://habrastorage.org/webt/nw/ex/ke/nwexketyzcovi-0dgfe4mg_cuu0.png)
. , 329 000 Go http, http 180 000 . , .
![](https://habrastorage.org/webt/gk/al/rl/gkalrlbrneqjdw5e4kpvuzr_jiu.png)
Python . 65 – 70 , , .
![](https://habrastorage.org/webt/l6/vc/1o/l6vc1ohv1ahyqn8zbsze2hawrye.png)
django, . , , 5 , 5-6 http, django , Twisted .
![](https://habrastorage.org/webt/_a/ct/8p/_act8prbq1debonqcs6uddsycsk.png)
latency, . , . . 100 , , .
![](https://habrastorage.org/webt/jx/k-/6r/jxk-6rk_vj-vjv4xmixaugvdbtk.png)
, Python latency, .. 7 . django.
![](https://habrastorage.org/webt/pn/ho/jb/pnhojb4qzwxg-x1m6niznjqqmty.png)
Latency django , Go. , 14 , 28 2 , (2ms 14,000req/s = 28 cores 1). Django . , , .
![](https://habrastorage.org/webt/i4/hv/18/i4hv18ij1dvbwkxim1m5i-46bdq.png)
, , , - , , . , ? , redis . , 10 000 100 , , , , 10 1000 - . json - 20 , 10 .
![](https://habrastorage.org/webt/a7/oc/dj/a7ocdjf4afbtufkaecefuzvfzoa.png)
redis , , Python 200 . . , 10 . – . , Go , Go , « », , , , .
![](https://habrastorage.org/webt/6x/v6/qu/6xv6qutrc0dokc-1wbj6k1v5cc4.png)
multiprocessing Python. , , 2 , . — 2 . , , , dict-update - .
![](https://habrastorage.org/webt/pv/cv/r-/pvcvr-hei8ozixa4ykjuc_5chsc.png)
, . , , , 10 , , 28 280 . Python. - - , Python .
![](https://habrastorage.org/webt/xf/e2/q0/xfe2q0aslngig_8dbi1hd2zgkka.png)
: - 28 , multiprocessing . , , , - . , redis 0,2 . Manager.Value - , .. . Prometheus mmap merged . , . mmap mutex merged. , .
![](https://habrastorage.org/webt/sz/cl/ev/szclevm6eam5yqa7ogq3plm0yvk.png)
Python 2018 Async/Await.
![](https://habrastorage.org/webt/g0/fr/ff/g0frffiyzcipmlhnjbg-c_02qqs.png)
. , , Go. , TopFace, - , , , . , . , - .
, 14 . , , ?
, , . 100-150-200, , , , goroutine . , , , , 200 -. goroutine, .
goroutine ? 200 , - , 100 , 14, - ? goroutine, , , goroutine, thread . goroutine - . Go . . . 3.7, .
![](https://habrastorage.org/webt/jo/kz/yj/jokzyje0uaq0tqmel9io3q4nh54.png)
, Go, scheduler. . syscall goroutine scheduler , , scheduler, syscall . 14 , 14 goroutine, syscall, , . , , .. - goroutine, - , , , -, , , , .
mutex , , , .
![](https://habrastorage.org/webt/av/n3/-o/avn3-o32pgvs4nob5go6ssoq_mu.png)
Asyncio . , , Scheduler, - kqueue, epoll. , , , Go. Async/Await - .
![](https://habrastorage.org/webt/y3/h6/fl/y3h6flzsfuu6bwspz4aq61zmgba.png)
, . . Async/Await. , - . , , . runtime , .
![](https://habrastorage.org/webt/gj/xb/fj/gjxbfj9wc5jgooobf4-dbhzeqj8.png)
, Asyncio . aio-libs, 11 . , , , - Close, . production Aerospike, . . - , , , , - .
![](https://habrastorage.org/webt/3j/dr/fr/3jdrfrgbuizhpdj3k3jablpdb9s.png)
Python thread. Go . Go. goroutine, - , : « ». , Graceful shutdown. , . Python , http, net . . - . , . Go , , , , .
![](https://habrastorage.org/webt/t8/q7/bg/t8q7bgl5ad2vkzetusxeadbgifq.png)
, Select Go , 5 . , 5 , 5 , -, -. Python queue, , , , . Go , .
![](https://habrastorage.org/webt/eb/-h/9f/eb-h9fz8twvdj8vtcgjxlpd0hrw.png)
, , Python Go. : « DataScience, , ».
![](https://habrastorage.org/webt/jj/6y/b7/jj6yb7hkh6ykmlsmmuj_fxo5jb4.png)
DataScience, , , DataScience .
![](https://habrastorage.org/webt/wb/z_/g7/wbz_g7k8ursqnu1nzjwqu06xkc0.png)
Go . - . , - , , , -, , , .
, , , , Python, .
![](https://habrastorage.org/webt/ah/rt/es/ahrtesbwrsazyvgqjtk-slh7pxc.png)
, . , SiKit — . , , , . . , . Sikit. Surprise , SVD. 2 , SVD, 2 SVD++, , , 3 . , Go SVD++?
![](https://habrastorage.org/webt/j9/cq/40/j9cq40ufpt5gricwkea7vxg2l1i.png)
2 . , , enterprise, , . , AVX2 20% SVD. , , , Go , Spark Go. .
![](https://habrastorage.org/webt/so/vs/rd/sovsrdvh5hubuxkfzjs9e4bjaja.png)
, Go , , . Go, . , , . 2 10 , - .
![](https://habrastorage.org/webt/-x/dp/1-/-xdp1-6la0jwnmun9oqa2fxh80c.png)
Go . pprof http. pprof.
![](https://habrastorage.org/webt/zd/zx/ab/zdzxab4c0xddy5qdoy5ocpnr8ci.png)
, , , - syscall . : « Garbage Collector» « mutex», « ».
pprof list func. .
disasm , .
![](https://habrastorage.org/webt/br/jo/do/brjodozgarx54bmld8_fm8l5jvu.png)
. .
![](https://habrastorage.org/webt/w1/ej/9i/w1ej9ip-vxf0dqauzccywy1oeea.png)
FlameGraph, Python .
![](https://habrastorage.org/webt/6v/j5/b-/6vj5b-p4ph2_edt0tyekskgwf4k.png)
, , , .
![](https://habrastorage.org/webt/-q/ll/jp/-qlljp7i1ojm2vt1zajlig27tqk.png)
gcflag -S .
gcflag -m pprof Inline .
C . , . , - , 8% , 8% 10% .
2 . Go , Go . : « http c , », . , , , .
![](https://habrastorage.org/webt/l2/ks/kj/l2kskjyrjqzkcqxgnh_egnzrrwq.png)
Pprof , , mutex, stacktrace, tracing . , , 5 . , , - , .
![](https://habrastorage.org/webt/ms/5k/jo/ms5kjoeb8wbp-l7cfsfjbpzkajw.png)
build-race — , . , , . Build-race race conditions, 4 , , .
, , , GC.
![](https://habrastorage.org/webt/t5/lt/py/t5ltpyoziej_er1woiay-uizemy.png)
, .
![](https://habrastorage.org/webt/-r/1r/ps/-r1rps3agpkuuo_wdyee5slw0ma.png)
Go , , , Go, 1.0 1.1, 1.1 1.2, 1.2 1.3 , 1.11 1.12, , , , . 2012 .
, . , . go get
Go , . . , . , - , , . , .
, /. . . , .
![](https://habrastorage.org/webt/a3/kv/ku/a3kvkuj1eo6jnhsojogvnpjevoc.png)
, , Python, 3.6 3.7 . , - QT .
Python , , , .
, , .
![](https://habrastorage.org/webt/wi/jt/md/wijtmdt397tcpmwyuqpnndxypfm.png)
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 , - . .
![](https://habrastorage.org/webt/ls/jo/to/lsjotog-fryeoamx8uo76cdhgvo.png)
Go. , , , . godoc.org .
, , , PR , . PR , go install .
- . , -, , .
![](https://habrastorage.org/webt/fx/jm/ta/fxjmtavyrgqpe6ozfciqtw3dkxm.png)
, Go, , .
![](https://habrastorage.org/webt/hm/84/wy/hm84wydhfesfwhqd0xh3kefh8by.png)
godoc -http=:6060
Go . . , 10 , - pydoc sphinx. godoc, , .
![](https://habrastorage.org/webt/vi/3o/lc/vi3olco0-w0fswml2usxke4y6zq.png)
. , Go Exception? , panic.
![](https://habrastorage.org/webt/_n/md/b8/_nmdb8qezji1fqh4ufojdzpqsfg.png)
, , , , , . , Exception? . Excepton , . . - -.
![](https://habrastorage.org/webt/e6/b4/25/e6b425ra3vvo-1sy4fejjksk8ea.png)
Go . , , . http get. , , - .
![](https://habrastorage.org/webt/3t/ry/cm/3trycmsib-mcex-capipxjk7oc4.png)
. , . 500 http code. http . http code 500 , 400 . , . Excepton , , .
![](https://habrastorage.org/webt/ap/b-/qd/apb-qd-af1zjlcdqt2osracluou.png)
. , , , .
![](https://habrastorage.org/webt/ut/jq/l3/utjql3e7_c43er0mr9cy-rvqcme.png)
. , Go UTF-8, Python 3.7 UTF-8, / .
![](https://habrastorage.org/webt/ck/s9/2e/cks92elx4ceaugt5-mlrfx5g8vk.png)
, , Python, Ruby, elixir, Go, Java. C++, .
![](https://habrastorage.org/webt/ia/ag/4t/iaag4t7qzdj3aunxqrxhvkurhoe.png)
– . , " " 2018 . , 75 Python 150 , 90% – 185 . "Get It" . , Senior Python 175 – 200 .
StackOverFlow, 100 , 98 Python.
![](https://habrastorage.org/webt/fm/zo/ff/fmzoffxgld-ukvhr19lh5o1_cty.png)
Go . " " 180 – 225 , "Get It" 205 – 250 , StackOverFlow 110 . + 20% , Go.
![](https://habrastorage.org/webt/30/yr/v4/30yrv4maqjycsnkxrfrhdwjtxsy.png)
Python , . Data science , , .
![](https://habrastorage.org/webt/a0/vb/uy/a0vbuysdum17zxuev1s8co1clcy.png)
, latency , , . , Go . , , .
Go , operation. / production . , .
Go ? .
![](https://habrastorage.org/webt/cv/jw/3e/cvjw3elt-jfjwutzkn9jgvdgkke.png)
: ?
: 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 - وظائف وحرة لمطوري جولانج