TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Go + Services = One Goliath Project

418 pointsby yawnover 5 years ago

31 comments

purple-againover 5 years ago
We turned our monolith into a bunch of micro services almost 6 years ago to the day. For a long time I was very happy with the new pattern but over the years the weight of keeping everything updated along with the inevitable corners that fall behind and have...questionable..security due to how long they sit neglected has really left me wondering if I am happy with it after all.<p>I would love hear some thoughts from others that made the move, especially anyone that decided to move back to a monolith repo.
评论 #21855304 未加载
评论 #21855167 未加载
评论 #21854906 未加载
评论 #21855029 未加载
评论 #21853889 未加载
评论 #21854670 未加载
评论 #21854460 未加载
评论 #21853904 未加载
评论 #21854062 未加载
评论 #21853902 未加载
评论 #21854806 未加载
评论 #21855984 未加载
评论 #21853950 未加载
评论 #21856840 未加载
评论 #21855963 未加载
评论 #21855438 未加载
kureikainover 5 years ago
Go is a very weird language :-(.<p>It&#x27;s very limited when you started to do complex thing. Example, let&#x27;s say you are building websocket. You will have a hard time to write type safe websocket handler to process the payload from client for all the events...<p>I started to do Rust&#x2F;Crystal and both of them are better than Go(performance, type system).<p>Yet, whenever I build something for work, I come back to Go :-(. I told myself to use Rust or Crystal.<p>Then I realized that Go is a practical language. It compiled fast so it makes testing easier. The cross compiler just make it so easy to build binary run on everything thing. And the limitation of Go makes it very consistent on how you do thing. This makes working with Go become faster event by the fact that it slows you down on other parts.<p>So I think Go is a language that people easier to fall into because it has the speed of interpreter language like Ruby&#x2F;Python(or even faster) during development and have a better performance&#x2F;type safe story.
评论 #21856835 未加载
plinkplonkover 5 years ago
just trying to understand - you guys think moving a Python2 monolith to Python 3 is too painful, and so you are going to port all the code from Python2 to a completely new language (Go), change the architecture (monolith -&gt; microservices) and move the HTTP API to React + GraphQL, all in one year?<p>2020 is going to be in an interesting year at Khan Academy ;-)
评论 #21855941 未加载
评论 #21860796 未加载
评论 #21858658 未加载
评论 #21856522 未加载
bhntr3over 5 years ago
&gt; If we moved from Python to a language that is an order of magnitude faster, we can both improve how responsive our site is <i>and</i> decrease our server costs dramatically.<p>I see people say things like this a lot but my experience is that while other languages are 10x or more faster than python in some benchmarks it&#x27;s very rare that computation time dominates server latency or that servers are running at 60%+ cpu across all cores.<p>If 90% of your service latency is not directly on the cpu and&#x2F;or you haven&#x27;t profiled to see that the performance bottleneck is evenly distributed across all tasks, then it&#x27;s super dangerous to migrate to a new language thinking that will fix it.<p>I hope people inside Khan Academy know this and it&#x27;s just a clickbait blog. If they really think &quot;go is 10x faster than python so we&#x27;ll only need 1 server for every 10 when we migrate&quot; then I think they&#x27;ll be disappointed.
评论 #21855190 未加载
评论 #21940516 未加载
评论 #21856456 未加载
评论 #21855230 未加载
评论 #21858709 未加载
harelover 5 years ago
Migration from python 2 to 3 is easy and fast. I&#x27;ve migrated multiple large apps and it took about a day each. Most libraries that matter have been migrated. Some don&#x27;t even support python 2 anymore. It&#x27;s practically 2020. This should not even be a consideration. After 2 to 3 is done they should consider again If they want to redo the stack but first I&#x27;d focus on this small maintenance task.
评论 #21856801 未加载
评论 #21856802 未加载
RandyRandersonover 5 years ago
Why do they call them &quot;micro services&quot; and not distributed systems? Oh right, it&#x27;s because distributed systems are obviously really hard to create correctly and no sane person would ever agree to pay for that.<p>Nice: re-branding. I can&#x27;t wait for the, maybe &quot;consolidated computing&quot; manifesto (aka turning micro services back into monoliths).
评论 #21855037 未加载
评论 #21855062 未加载
评论 #21855051 未加载
zmmmmmover 5 years ago
I think some of the misunderstanding in these comments comes from not fully appreciating the perspective of not-for-profit organisations. While I can&#x27;t speak for Khan Academy, I know that in every NFP organisation I have worked for there is an acute awareness that funding could dry up one day and the prime directive is to ensure that in a scenario like that, the work of the organisation can continue.<p>In this case, it leads to a higher concern about minimising the cost of the operational services than you might have in a for-profit organisation. In all the strategic planning I have been involved in with NFP, we always have the &quot;what if worst case scenario arises&quot; plan and in that plan the ability to scale down to bare minimum operational cost is key. It may not be conscious but I suspect that may be part of the reason the performance savings from moving to Go are so attractive in this case, where most profit-making companies just ask the question of whether they can afford to pay for the servers with their current margin or not and if they can they have more important things to worry about.
peterwwillisover 5 years ago
So, some potential pitfalls:<p>- The decision seems to be primarily a software architecture one, without much mention of all the other architects whose input will shape how the finished product is run and supported. In a modern software development environment, all the other parts of the org should be consulted on greenfield work to &quot;Shift Left&quot; anything that may need to change down the pike. Design in a silo leads to ineffective products.<p>- They&#x27;re going from &quot;hmm we need to upgrade from Python 2 to Python 3&quot;, to &quot;we need to redesign everything in a new language with a radically different software architecture&quot;. This is definitely the second system effect. It&#x27;s going to take years to make this thing reliable and sunset the old product.<p>- They&#x27;re porting over the logic? Even if this is actually the right move, wouldn&#x27;t a clean-room implementation potentially give better outcomes?<p>- Why are they continuing to use App Engine if the writing&#x27;s on the wall for 2024?
评论 #21854712 未加载
评论 #21854633 未加载
评论 #21855721 未加载
kucingover 5 years ago
Looking at the case where khanacademy is migrating their server only after about 10 years. I realize more that I don&#x27;t have to worry that much about being locked into certain technologies (unless it&#x27;s clearly untransferable, e.g. storing part of customer data in 3rd party server), because after all, we might keep it only for about 10-20 years, and the thing I&#x27;m working at almost certainly will only last &lt; 2-3 years.
todd3834over 5 years ago
&gt; We’ll only generate web pages via React server side rendering, eliminating the Jinja server-side templating we’ve been using<p>I’ve been down this road. Deep down this road. Let me just give you a heads up on something I didn’t consider at the time: Most template languages do not parse every single node, one by one. In a sense they are just doing string concatenation. Not so with server side rendering and React. I’m not saying it can’t be done but just realize it is going to take a lot more compute power. Caching is great of course but won’t help you if you plan to customize user content during the server side rendering as well. My recommendation is that you don’t do any user authenticated stuff during SSR.<p>Also consider how you are going to handle cookies if you do plan to make authenticated requests to server side rendering. Also solvable but for some reason people had the hardest time understanding why we had to forward cookies to the domains we controlled in an API request and definitely not to any other servers.<p>I’m not sure I would pick React for an SEO driven website. It is hard to get a competitive “time to first byte”. Unless of course you can pre warm a cache of every one of your pages.<p>Lastly, you’re going to need Node for the SSR. I’m sure you know this but that might take you out of app engine and into cloud compute. Not a big deal but thought I’d mention.<p>Good luck! It is doable. If you ever want to chat about how we solved some of these problems I’d love to save you some time if I can. Hit me up in my profile email.
评论 #21858775 未加载
benatkinover 5 years ago
The article says this: &quot;Moving from Python 2 to 3 is not an easy task.&quot;<p>I disagree with this. It&#x27;s a Python project&#x27;s dependencies that make it hard to move from 2 to 3, and most libraries have been updated.<p>Of course, you could argue that it isn&#x27;t easy to migrate a codebase from one major version of a language (or framework, or database) to another, but when you eliminate <i>easy</i> from your vocabulary it becomes harder to describe different levels of difficulty.
评论 #21854312 未加载
评论 #21853890 未加载
评论 #21853920 未加载
sethammonsover 5 years ago
I&#x27;ve been in a similar boat. We&#x27;ve been splitting up or converting large Python 2.6&#x2F;2.7 applications into Go services (and doing the same to large Perl applications) for a long time now.<p>Go has consistently been 10-20x performant (allowing for dramatically reduced hardware needs), easier to maintain, and more productive to produce code in than our previous Python (Twisted) and Perl (AnyEvent).<p>Hopefully KhanAcademy has solid telemetry data in both legacy and new code so they can quantify benefits. They will also have a learning curve for managing multiple micro services vs monoliths. Accessing shared data will be a problem they will likely have to solve. We&#x27;ve opted for each service controlling its own data - no reaching into another service&#x27;s data behind its back. Everything through APIs. This gives the microservice the ability to alter its datastore as it needs to and not be blocked by other teams&#x27; need to update how they access the data.<p>Debugging a distributed solution is much harder than a single service. Distributed tracing, consistent structured logging with log aggregators that let you do fancy searches (like Splunk), and application telemetry and metrics will be even more important than before.
评论 #21858756 未加载
d_burfootover 5 years ago
I heard about this project from a friend who works at KA. I am concerned about the strategy, and I think the following approach would yield better results:<p>1. Write in Go an exact reimplementation of the current Python codebase. Use the same database schema, front-end HTML&#x2F;JS, test suite, and so on. To whatever extent possible, use the same names for classes and functions. Check the reimplementation correctness by using a comparison tool that calls both the Python and Go version of a page&#x2F;function&#x2F;search and making sure that they produce the same results.<p>2. Change the production code over to the Go version, perhaps using a ramping strategy where X% of servers are running the Go code, and you gradually increase X, while monitoring vital statistics like server load and response time.<p>3. Now that the production site is running Go, incrementally split off components into their own services.<p>This approach leads you to the same destination, but with a lot less risk. It is very unhealthy to have a situation where the production site is running one codebase but all the developers are working on another codebase. Note that you will realize the benefits of Go (performance, type safety) after step 2, which is much sooner than OP&#x27;s plan.<p>Joel Spolsky&#x27;s classic essay about how you should never do full codebase rewrites is worth reviewing:<p><a href="https:&#x2F;&#x2F;www.joelonsoftware.com&#x2F;2000&#x2F;04&#x2F;06&#x2F;things-you-should-never-do-part-i&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.joelonsoftware.com&#x2F;2000&#x2F;04&#x2F;06&#x2F;things-you-should-...</a>
评论 #21857322 未加载
评论 #21857339 未加载
评论 #21858736 未加载
评论 #21857278 未加载
评论 #21857338 未加载
wonjohnchoiover 5 years ago
It is crazy to see they are still using python 2. Seeing how slow the conversions to python 3 have been, was creating python 3 a good decision for python community? Can it be argued that developing python 2 further in a backward compatible way would have been better for the community? I know that evaluating this kind of thing is hard as metrics are bound to be subjective and speculative. But I am curious if there was any serious attempt to figure it out.
评论 #21855194 未加载
评论 #21855184 未加载
aazaaover 5 years ago
&gt; Now, in 2019, Python 3 versions are dominant and the Python Software Foundation has said that Python 2 reaches its official end-of-life on January 1, 2020 , so that they can focus their limited time fully on the future. Undoubtedly, there are still millions of lines of Python 2 out there, but the truth is undeniable: Python 2 is on its way out.<p>The Python 2&#x2F;3 split is by far the most annoying thing about Python. I don&#x27;t develop software in Python but about half the time I&#x27;ve had to use a Python library or program the problem of 2&#x2F;3 incompatibility has cropped up. Some projects don&#x27;t make it clear whether one or the other is required, leading to further confusion.<p>If anything the Python 2 EOL could make a bad situation worse. Like Khan Academy, each Python 2 package maintainer will be forced to make a decision: move to Python 3 or abandon and maybe move to an entirely new language. It think many will choose to abandon, leaving these packages to rot.<p>Second on the list are the multiple package managers (or things looking like package managers).<p>Third on the list of annoyances are native extensions, driven by the poor performance of Python itself. These extensions make it difficult to use certain libraries across operating systems.<p>So as a non-Python developer I don&#x27;t look forward to the occasions when I must use a Python-based piece of software.
评论 #21854132 未加载
评论 #21854279 未加载
评论 #21854657 未加载
atmosxover 5 years ago
How does Khan academy make money to sustain the website? Is it all donations?
评论 #21853824 未加载
评论 #21853818 未加载
tybitover 5 years ago
As much as I personally don’t enjoy writing Go I really can’t fault them.<p>I still find it interesting that for a relatively obvious feature set of fast compiles, fast startup and fast runtime there really isn’t anything mainstream out there to compete with Go.<p>I really hope something like Kotlin, Swift, ReasonML or even AOT JVM&#x2F;.NET brings something to the table soon. Or perhaps I’ll just have to wait for WASM to really take off server side.
评论 #21854416 未加载
评论 #21854706 未加载
评论 #21856210 未加载
评论 #21854720 未加载
timwaaghover 5 years ago
Seems like such a waste. Is switching to python 3 really that hard? Is hardware that expensive? If this is indeed the right call it doesn&#x27;t bode well for traditional scripting languages as the web scales to fewer high traffic apps. We might start to see more jvm, go (apparently) or even rust and c(++), rather than speed of development languages like Python or Ruby. Trend seems to be the reverse though, with python the second and most rapidly growing language.
评论 #21853986 未加载
评论 #21853930 未加载
评论 #21853994 未加载
评论 #21854078 未加载
评论 #21853936 未加载
评论 #21854567 未加载
评论 #21853915 未加载
评论 #21854209 未加载
评论 #21853945 未加载
评论 #21854715 未加载
评论 #21854268 未加载
评论 #21854075 未加载
tmpfileover 5 years ago
Yikes! It&#x27;s a lot of effort to reduce memory use. They might be better off creating a new Go entrypoint&#x2F;server that can call into CPython to reuse all their existing&#x2F;tested modules (treat their Python as a microservice called by Go). They could then use Go to create&#x2F;call new microservices or replace various routes on a selective basis.
mjpuserover 5 years ago
I think the real problem is that they didn&#x27;t properly maintain their code. Rewriting it in Go won&#x27;t prevent them from dealing with this in a few years for when this Go version reaches end of life. I would have liked to see an article on &quot;introducing process&quot; side of programming.
评论 #21858804 未加载
ngngngngover 5 years ago
Unpopular opinion, writing Go is faster than Python. With the compiler, strong typing, and no versioning hell, I&#x27;m much more productive in Go.<p>Whenever I use python I run into problems with versions and dependencies. And the whole community just tells me to use pyenv or virtualenv and it will &quot;fix all my issues&quot;. Only it doesn&#x27;t.
评论 #21854536 未加载
评论 #21854297 未加载
评论 #21854908 未加载
评论 #21855247 未加载
评论 #21854521 未加载
评论 #21854866 未加载
评论 #21856565 未加载
bootloopedover 5 years ago
The article mentions Go&#x27;s superior compile time, when compared to Kotlin. I have done a lot more Java development than Kotlin, but my recollection is that both of them compiled fairly fast.<p>Is Go really significantly faster to compile for similarly sized projects?
评论 #21854330 未加载
评论 #21854983 未加载
评论 #21854845 未加载
评论 #21855039 未加载
remote_phoneover 5 years ago
What a mistake.<p>Not only going from a monolith to microservices but also changing the language? This is a mistake that rookies make. This will be one of those post-Mortems where they will sheepishly admit they bit more than they could chew, and it wasted years of productivity.<p>There’s no reason to move to Go. Stick with Python for now. Migrate safely to python 3. Once everything is stable, start breaking things up into thrift or protobuf services. They don’t even need to be microservices but you need the contract. Once that is stable migrate to whatever language you want. But at this point you will have the well-defined api and test cases. Trying to do too much all at once is a no-brained disaster.
评论 #21855581 未加载
sibeliussover 5 years ago
Isn&#x27;t there a quote somewhere along the lines of &quot;full rewrites are suicidal?&quot;<p>Seems pretty risky to me.
评论 #21854658 未加载
评论 #21854587 未加载
评论 #21856586 未加载
tonyover 5 years ago
You can start porting your live codebase to python 3 right now - no downtime at all. You can have a 2+3 compatible codebase live in a week or two, it&#x27;ll get you about 98% the way there [1]<p>My projects (e.g. <a href="https:&#x2F;&#x2F;tmuxp.git-pull.com" rel="nofollow">https:&#x2F;&#x2F;tmuxp.git-pull.com</a>, <a href="https:&#x2F;&#x2F;unihan-etl.git-pull.com" rel="nofollow">https:&#x2F;&#x2F;unihan-etl.git-pull.com</a>) are both python 2&#x2F;3 compatible.<p>I learned by reading through other projects like Sphinx, Flask, Werkzeug, and SQLAlchemy:<p>- Flask: <a href="https:&#x2F;&#x2F;github.com&#x2F;pallets&#x2F;flask" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pallets&#x2F;flask</a><p>- Werkzeug: <a href="https:&#x2F;&#x2F;github.com&#x2F;pallets&#x2F;werkzeug" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pallets&#x2F;werkzeug</a><p>- Sphinx <a href="https:&#x2F;&#x2F;github.com&#x2F;sphinx-doc&#x2F;sphinx&#x2F;tree&#x2F;v1.8.5" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;sphinx-doc&#x2F;sphinx&#x2F;tree&#x2F;v1.8.5</a> (see compat: <a href="https:&#x2F;&#x2F;github.com&#x2F;sphinx-doc&#x2F;sphinx&#x2F;blob&#x2F;v1.8.5&#x2F;sphinx&#x2F;util&#x2F;compat.py" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;sphinx-doc&#x2F;sphinx&#x2F;blob&#x2F;v1.8.5&#x2F;sphinx&#x2F;util...</a>)<p>- <a href="https:&#x2F;&#x2F;github.com&#x2F;sqlalchemy&#x2F;sqlalchemy" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;sqlalchemy&#x2F;sqlalchemy</a><p>Helpful blog posts: <a href="http:&#x2F;&#x2F;lucumr.pocoo.org&#x2F;2011&#x2F;1&#x2F;22&#x2F;forwards-compatible-python&#x2F;" rel="nofollow">http:&#x2F;&#x2F;lucumr.pocoo.org&#x2F;2011&#x2F;1&#x2F;22&#x2F;forwards-compatible-python...</a>, <a href="http:&#x2F;&#x2F;lucumr.pocoo.org&#x2F;2013&#x2F;5&#x2F;21&#x2F;porting-to-python-3-redux&#x2F;" rel="nofollow">http:&#x2F;&#x2F;lucumr.pocoo.org&#x2F;2013&#x2F;5&#x2F;21&#x2F;porting-to-python-3-redux&#x2F;</a><p>As for automation tools, for 2&#x2F;3 compatibility, I used futurize and huge codebase to great success: <a href="https:&#x2F;&#x2F;python-future.org&#x2F;futurize.html" rel="nofollow">https:&#x2F;&#x2F;python-future.org&#x2F;futurize.html</a>. I started with this:<p><pre><code> futurize --write --stage1 --unicode-literals --nobackups &lt;files&gt; </code></pre> and <a href="https:&#x2F;&#x2F;docs.python.org&#x2F;2&#x2F;library&#x2F;2to3.html" rel="nofollow">https:&#x2F;&#x2F;docs.python.org&#x2F;2&#x2F;library&#x2F;2to3.html</a><p><pre><code> 2to3-2.7 -w -n &lt;files&gt; </code></pre> Really helped.<p>Also, wire Travis &#x2F; your CI system to have your tests run on python 2 and 3.<p>If you want to test your python 3 codebase live on a subdomain &#x2F; same SQL&#x2F;NoSQL DB, be careful about jobs&#x2F;tasks! Pickle version mismatches and stuff. Use a separate redis&#x2F;whatever DB for the deployments.<p>After you&#x27;re finally on python 3, you can use <a href="https:&#x2F;&#x2F;github.com&#x2F;asottile&#x2F;pyupgrade" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;asottile&#x2F;pyupgrade</a> to modern your code.<p>[1] For the other 2%, use conditionals in your requirements file:<p><pre><code> enum34==1.0.4;python_version&lt;&quot;3&quot; ushlex==0.99.1;python_version&lt;&quot;3&quot;</code></pre>
评论 #21855011 未加载
thatswrong0over 5 years ago
Ok this is going to sound ignorant, as my only experiences in backend services have been Go and Python. I don&#x27;t like either. Is there something I&#x27;m missing? For simple CRUD apps, both are sufficient. But (in my limited experience), the moment I&#x27;ve wanted to create more complex business logic with stricter constraints, neither has been quite up to the task.<p>Go doesn&#x27;t make things easy. It asks you to repeat yourself. I don&#x27;t like the lack of basic functions like a generic map &#x2F; filter function.. I know Rob Pike just says &quot;use for loops&quot;, but it feels so unnecessarily unexpressive. When I see map, I know what&#x27;s going on almost immediately. For loops take more reading to understand. Nil pointers shouldn&#x27;t be, yet still are, a thing (developers aren&#x27;t perfect - why can&#x27;t the type system help?). It feels like a straight downgrade from Python from a code clarity perspective. And it&#x27;s typed, sure, but the type system doesn&#x27;t let me express constraints that other languages allow me to do that would prevent entire classes of bugs. It doesn&#x27;t feel worth it compared to Python. Yes, the core language ends up being comparatively &quot;simple&quot;, but simple building blocks doesn&#x27;t guarantee a simple overall system. And my company is very diligent from an architectural perspective.<p>But then when I look at Python, I&#x27;d rather just use Javascript with Lodash, esp. when it comes to the treatment of functions as first class objects[0]. Throw Typescript in there, and you get, in my opinion, a better type system than Go, so unless language performance is a major constraint (which it hasn&#x27;t been for my company, our DB usage patterns it the biggest thing instead), why would I want to use either of these rather than Typescript?<p>[0] Edit: Dumb and wrong, I meant its treatment of anonymous functions. I don’t like lambdas.
评论 #21854506 未加载
评论 #21854046 未加载
评论 #21854518 未加载
评论 #21854035 未加载
评论 #21854300 未加载
评论 #21854622 未加载
评论 #21854485 未加载
评论 #21854693 未加载
评论 #21854666 未加载
评论 #21854007 未加载
评论 #21854625 未加载
评论 #21854085 未加载
评论 #21854127 未加载
评论 #21854414 未加载
评论 #21854363 未加载
评论 #21854119 未加载
aptaover 5 years ago
&gt; Go, however, used a lot less memory, which means that it can scale down to smaller instances.<p>I could be mistaken, but this sounds like they went ahead with the default JVM settings, where it tends to use as much memory it is allowed to (which makes sense from a utilization and efficiency perspective). If memory usage is a concern, the JVM can be tuned for such.
评论 #21856194 未加载
buboardover 5 years ago
If they were going for performance, and web-related, how come they didn&#x27;t consider PHP?
Possiblyheroinover 5 years ago
I was under the impression that Go was more performant than Kotlin. TMYK :)
评论 #21853862 未加载
评论 #21854027 未加载
评论 #21854097 未加载
评论 #21853838 未加载
评论 #21853816 未加载
Thaxllover 5 years ago
Kotlin looks nice now but on the long term it&#x27;s a bad choice since they&#x27;re stuck on Java 8 they will always lag behind the real JVM and won&#x27;t be able to catch up since they need heavy modifications.
评论 #21854141 未加载
Solar19over 5 years ago
Interesting read. It always surprises me that companies go many years running major apps and infrastructure with interpreter-based languages like Python and Ruby to begin with. It&#x27;s an incredible waste of energy, compute, and for web apps sometimes, users&#x27; time.<p>Developers need to be a lot more disciplined about performance and efficiency. I&#x27;m glad Khan went to Go, but man all those years wasted.