Hacker Newsnew | past | comments | ask | show | jobs | submit | more wrong_variable's commentslogin

China looks at things that US / EU have a monopoly in.


Alright if its so bad then why use it ?

Get your own army of coders to create your own 5G electronics.

Nobody is forcing the Brits to buy Huawei Gear - they did it because it was cheaper and they wanted to save a buck.

Huawei will be profitable even if UK,USA,AUS,EU completely stops buying their gear.

The scary part is not that their code is bad, but that they code at all.

30 years ago those hands were picking rice in rural china, and 30 years from now who know what those hands will be doing, maybe writing code for their moonbase.

Chinese gears is a boon to African, Latin American, South Asian countries. Chinese Yaun puts less pressure on their FX reserves.


OPEC is a cartel we can get behind, simply because without them price of oil would be 3 USD / barrel.

We would be at 500 ppm if not for the irrational boycott of the West by King Faisal.


The main driver of C02 reduction is based around geopolitical forces and national interest, and the west is on the wrong side of history on this one.

We got lucky that China / East Asia / India do not have access to cheap hydrocarbon, aligning their national interest with that of longer term survival of humanity.

Some dude in BC is vacuuming up C02 in his backyard and this becomes news ?

Meanwhile ...

- China continues to shave off millions barrels of global oil consumption due to their initiatives involving electric buses for the masses.

- China dumps so much solar production capacity on the market that it undercuts coal and gas.

The solution to climate change is not going to come from cute startups but from national projects.

When history books are written, the pages will be filled with praises of national initiatives taken by govts of south korea, china, germany, ... ( india ? not sure yet have to wait and see ).

Pretty words are not going to be written about the richest and most carbon intensive nation on earth along with its cronies ( Canada / Australia / UK ) actively undermining efforts to fight climate change ( while continuing to export and use fossil fuels to support the bulk of their GDP ).

But you will always have some dude vacuuming up CO2 in his backyard in BC to provide moral licensing.


China may be on the right side with clean energy, but also on the wrong side with massively increasing their methane output, increasing desertification, etc: https://www.theguardian.com/environment/2019/mar/29/can-the-...


In terms of residence in the atmosphere methane is reported to have a half-life of about 7 years. Carbon dioxide's is much much longer with estimates from 40 -> N years where N might be in the thousands.


So you are saying it could be worse. However, if they raised those cows properly it would even help with fighting climate change. But I'm sure they are going down the animal factory route instead.


The UK has cut emissions more than ANY other country


I found different data. Perhaps the UK cut emissions by a larger % but US by nominal tons?

https://www.forbes.com/sites/rrapier/2017/10/24/yes-the-u-s-...

According to the 2017 BP Statistical Review of World Energy, since 2005 annual U.S. carbon dioxide emissions have declined by 758 million metric tons. That is by far the largest decline of any country in the world over that timespan and is nearly as large as the 770 million metric ton decline for the entire European Union.

By comparison, the second largest decline during that period was registered by the United Kingdom, which reported a 170 million metric ton decline. At the same time, China's carbon dioxide emissions grew by 3 billion metric tons, and India's grew by 1 billion metric tons.


> annual U.S. carbon dioxide emissions have declined by 758 million metric tons. That is by far the largest decline of any country in the world over that timespan and is nearly as large as the 770 million metric ton decline for the entire European Union.

This is deceptive.

The emissions per capita in the US were much larger than in the UK or the EU to start with, which means still many low hanging fruits waiting to be picked. The lower your emissions are from the start, the harder it is to lower them even further...


In other words, UK per capita emissions have fallen 30% more than the US since 2005. And that is from a much lower base.


The UK has outsourced it emission .. since it helps prop up property prices in London to not have industrial waste being dumped into the Thames.

Also the money from pollution in China/Russia/ME ends up leaking to buy up property in London because you know .. nobody wants to live near a coal mine.

The UK provides direct military support to the Kingdom of Brunei - one of the largest exporter of Petroleum.

The UK props up several petro states in ME if you haven't noticed and also sends its own men to die in case their ME cronies are threatened.

UK oil companies help loot the natural resources of Nigeria and then provide banking services to a small group of warloads to hide that wealth.

The UK is the big spider in the middle of the global web that connects oil, blood and money.


Do you think other developed countries do not import manufactured goods from China? Those countries have outsourced their emissions and still increased domestic emissions. UK domestic per capita emissions are half what they were in 1990, which is unprecedented. Other than altering the trade deals, which the UK does not have the power to do anyway, it’s difficult to see what else could be done.


Maybe he gave Xi his first born.


Relax, bees were already wiped out in some regions with heavy pollution in China, and what happened was humans were made to do the work of the bees - which it turned out was cheaper than depending on bees !

In case we do lose a large part of the ecosystems humans can still survive on potatoes - 2 billion people already survive on rice / root plant , so the only thing lost would be luxury items enjoyed by the top 40% of the human population.

Maybe it will push them to worry about more serious stuff like sea level rise ?

There is always liquefied cockroaches.


There was this great quote from writer Kara Brown that goes:

"If I Need a Gas Mask, I’d Rather Be Dead"

I honestly agree with that. If all I have left to eat is liquid cockroaches, I'd rather be dead.


I think that is just part of the cycle. Life will get difficult, many will die, less people would mean less pollution, and then the earth can clean itself until things are nice enough for people to multiply and ruin things again.


I would gladly remain alive for both of you. Would not be easy but somebody must make a sacrify and do the job.

As long as is organic and with six legs can be distilled.


Yup, human workers seeem to be cheap... in China. And children would be even cheaper. All advantages.

On the other hand the idea of eating fruits cultured in heavy polluted areas seem... maybe not our brightest idea.


and liquefied people


I have given up on NodeJS and moved solely to Erlang for long term projects.

I still love NodeJS ! but once you learn Erlang its hard to go back, it reminds me of PG's having a higher bird eye view.

NodeJS, Python, Haskell (!), PHP, C - all belong to the same class of coding style with the same type of problems.

You use Erlang not because of playing the testosterone game of nominal performance - but because you really want some guarantee.

( Money should be not a problem since the world seems flush with cash - if your manager is complaining its because he wants his bonus to be higher. )


Care to elaborate what these types of problems are and how erland fixes them?


Sure !

Think about how prinf / console.log / print .... works in traditional settings.

- How would you make it so that printf doesn't crash your entire program if the console hangs.

- how would you isolate a single codebase's IO operations ?

- How would writing to console work in a multi threaded environment ? multi server ? 100 servers ?

Haskell sort of tries to answer these questions but I am not sure how its going go work out for them, in Erlang's process based universe all those questions have been answered already !


Sounds like reasons to prefer FP over OOP, not necessarily Erlang.

I do really appreciate Erlang / Elixir (have contributed several libraries), but the problems you describe are not uniquely solved by Erlang. Akka / Scala is another take on the whole actor based architecture, and seems to have considerably more traction (hiring talent will be easier for your manager).


You should really read jhgg's response describing the BEAM runtime's pre-emptive scheduling of its lightweight processes: https://news.ycombinator.com/item?id=19241194 . No other runtime can do that for you, not even the JVM.


> Akka / Scala is another take on the whole actor based architecture, and seems to have considerably more traction (hiring talent will be easier for your manager).

They solve a subset of the problems that Erlang's OTP solves. They don't have the entire package.


Where I live, it is easier to find local Elixir talent than Scala. There was a big Ruby community here and many of them have moved to Elixir.


> but the problems you describe are not uniquely solved by Erlang

I agree, I do not any Scala / Akka experience so I cannot argue for or against due to ignorance.

But as you say at least the platform / language addresses these concerns.


>> How would you make it so that printf doesn't crash your entire program if the console hangs.

Why would the console hang? If that happened, it would signal a major issue at the OS level and probably not related to your application (unless you're trying to log an extremely massive string; which is a bad idea and you'd probably already have run out of memory before that could happen). I have never seen the console/stdout hanging in production and I've built some pretty high-traffic distributed systems with Node.js.

>> how would you isolate a single codebase's IO operations ?

What sort of IO operations are we talking about? Network, Disk? There are many ways to inspect different kinds of IO operations. The Node.js ecosystem offers a large number of modules which would let you achieve that.

>> How would writing to console work in a multi threaded environment ? multi server ? 100 servers ?

Node.js is perfect for running on Kubernetes. There are many K8s dashboards and tools which allow you to browse and aggregate logs from thousands of machines with very little effort. I don't see how this point has anything to do with Erlang specifically. A language-agnostic container orchestrator like Kubernetes is the best way to go over a tool which only works with a specific language.

There are Node.js frameworks which offer kubetnetes .yaml files and CLI tools which allow you to deploy a highly scalable cluster to K8s in a few minutes.


Can we all take a step back here and for a second realize that Node.JS is based upon a language/event model that was purpose-built and designed to handle client side browser operations, and has since been expanded into the server space. And Erlang/OTP/BEAM was built and designed for running reliable soft real-time distributed telecom systems.

By default (and unless you go out of your way w/ web-workers) the javascript event-loop (and thus nodes event loop) is single threaded. To work around this, you can bind many node processes to a given port to load balance requests (SO_REUSEADDR, anyone?) - or simply run many smaller instances of node (perhaps in a bunch of containers) where traffic ingresses in via some form of load balancer. The load balancing problem is unavoidable, and you will definitely need the same if you want to send requests to multiple BEAM nodes. However, BEAM can schedule your work across all the cores you give it.

But let's talk about work for a second, and about a very special thing that the BEAM VM gives you, that other runtimes (whether it be node, JVM, golang's, etc...) aside from the actual operating system of your computer does not. And that's specifically preemptive scheduling.

Suppose you have a single core computer that's running Linux, and you have a process that is sitting there busy looping. Let's say we just make a simple script that does nothing infinitely in a loop. Does your computer grind to a halt? Most likely, no. You can still probably use your terminal, move your mouse, operate your web browser, etc... You can thank pre-emptive scheduling for that. The OS suspends the process to allow other processes to do work - hopefully in a fair manner (on linux, the CFS (aptly named Completely Fair Scheduler) does this).

Now let's say you have a single node process serving requests. Let's say that a specific kind of requests requires 250ms of CPU time to compute - and does not explicitly yield back to the event loop. (You can imagine doing some processing of input data, deserialization, serialization, aggregation, etc...). During this computation, nothing else within the node process can progress. This means that requests that may not take a lot of time to compute now have to wait 250ms to be processed. Generally, I see node deployments not having single request/response request handling, but rather many concurrent requests/responses being handled at any given time, using promises/callbacks to allow the event loop to progress while waiting on IO from something else. During the periods of expensive computation from a given request handler, the entire event loop is stalled, and the response time percentiles of your requests spike. A pathological case would be something like `setTimeout(() => while(1) { }, 1000)` deadlocking your entire node process after a whole second, as the loop does not yield back to the event loop.

In BEAM, this does not exist. Processes are scheduled and pre-empted - to allow for fair utilization of the underlying computation resources (very much like how your OS does it.) This means that a computationally intensive process does not stall the event loop for all other processes, meaning that your response times and percentiles remain low for all other work within the system.

Now of course, you could hand-craft your javascript code to explicitly yield to the scheduler every so often, but that's a lot of work that you as a programmer are now doing that your runtime could be doing for you, and if you forget to do it, could be catastrophic to the performance of your soft-realtime system.

This is only one of the many benefits that OTP/BEAM provide over other runtimes. But one compelling enough for Discord as a company to bet on it. For a given service, we run entirely homogeneous infrastructure. We do not need to allocate or dedicate special resources to our largest servers (100k CCU/350k members), and instead can run and schedule it alongside the millions of other small servers that exist on Discord - all without negatively impacting the performance, percentiles, or soft-realtime guarantees of your chat with a few of your friends.


The NodeJS cluster module can be used to do load balancing between multiple processes on the same machine - It supports load balancing either at the OS level or at the application level. The application level 'round robin' approach is the default and leads to more even distribution between processes in terms of CPU usage. The application 'round robin' approach may be limited in terms of scalability at some point but I've done tests with 32 processes on a 32 core machine and I couldn't see the slightest sign of struggle from the process which hands off the connections to worker processes. Hopefully, eventually the OS scheduler in Linux will have improved enough to outperform the application-level LB but for now it hasn't.

In any case, you don't necessarily need loadbalancing at the host level, you can load balance at the cluster level only. Your load balancers (e. g. nginx or haproxy...) have their own hosts/machines in your cluster and they loadbalance between processes directly. Some of those may be running on the same machine but the load balancer does not dostinguish between them. A random load balancing approach yields the most even distribution from my experience - You do need each process to be able to support maybe 1k concurrent users in order to get the sample sizes on each prpcess to allow even random distribution between them but this is easily achieved with most Node.js WebSocket libraries. They can easily support 10K concurrencr connections per prpcess with very high message throughput. If the commections are mostly idle, each process can handle 100k connections or more.


Load balancing a bunch of connections between a bunch of processes across a cluster of nodes is pretty well understood. I don't think that's what I'm trying say here. My post is more on the power of pre-emptive scheduling built into the runtime, and what it means for your application.

We use BEAM/OTP for way more than just holding open websocket connections. Our entire websocket layer is a few hundred lines of elixir code - and honestly hasn't been touched in over a year - and has remained pretty much the same as we scaled from 200k ccu -> to well over 5m ccu. Holding open websockets and load-balancing them is pretty much a solved problem for us.


How is this related to programming languages - I think these are platform issues and design choices. How does Erlang help there (curiously interested)?


You should read on the fault tolerance guarantees of Erlang OTP. It's really hard to be summarized. Supervision trees, "let it crash and get safely restarted", super-mini-processes that have preemptive scheduling built-in, soft real-time...

TL;DR: No, no other language or framework in the world has the primitives that Erlang and Elixir have.

People on HN and Reddit really love acting non-impressed and claiming the pain points are easily solved in other languages.

My 17 years of career say this is not true at all.


Erlang's language syntax is kinda awful but that is besides the point.

Issues I have raised are 100x harder to address then some syntax.


Those are good points, but does node fail in the scale requirement?

I mean supposing we can get past console printing issues?


Node is awesome for fast and quick projects / cmd tools.

- For example I have a project involving smart electrical inverters, I need some guarantees regarding crash handling / low latency. Not a lot of scaling issues.

- With scaling involving NodeJS, I consistency had issues with exploding RAM and crashes - unable to isolate part of codebase.

I struggled a lot to fix these problems, so while searching for a solution I came across Erlang and haven't looked back.


The problem with your reasoning is you're trying to make your program very resilient when it shouldn't be, let the underlying infrastructure deal with that, if it crashes it will be re-created. BEAM and Erlang are the wrong solution for those problems because not language neutral. I can make my nodejs / PHP app as resiliant as Erlang using Kubernetes.


Infrastructure can never get to any reasonable level of resilience alone without programs being designed for resilience and such ignorance will likely lead to nasty stuff, like cascading failures, because of massive load differences between normal operations and attempts to handle errors by recreating entire services. But Kubernetes itself is not known for its resilience, on the contrary, its reliability reputation is pretty bad at this point, unlike that of Erlang.

Design for resilience is not a small thing. I suggest to read Joe Armstrong's "Making reliable distributed systems in the presence of software errors" [1] as a starting point on this.

[1] http://erlang.org/download/armstrong_thesis_2003.pdf


I'm not saying that you should not add resilience in your program, but that OP claims about "what if printf crashes" well that's it it will crash deal with it. You should ensure your platform will recover if you program crash not try everything possible to not make your program not crash.

"Pet vs Cattle"

The thing I don't like about Erlang is about the runtime that is mixed between code and infra which I think is not a good idea, it was designed before we made progress with HA platform like Kubernetes. https://github.com/kubernetes/community/blob/master/sig-scal...

It should be separated and it's what pretty much everyone is doing nowdays.


Say you have a bug in a minor feature, that most people wouldn’t care about, but triggers the crash. Now someone’s trying to use this feature once or twice per minute.

If you rely on the infra for recovery, you’re going to be in serious trouble. There may be 300k users connected to an app instance, and you’re going to be kicking all of them out and restarting an instance every time the minor feature is called. This turns a minor bug into a full-blown outage.

Now we’re talking about a “printf crash” as an example, but in my experience the issues are more subtle. I’ve seen a Python app leak file descriptors due to a bug in an object’s destructor, which only happened when an exception was thrown in a certain place. This caused a service outage as the app looked “fine” from the infra’s point of view (it could respond to health check requests), but the functionality was dead. With Erlang processes, using a process per connection, the VM guarantees resources are cleaned up when a process dies, so that kind of issue doesn’t happen.

The Zen of Erlang goes a bit deeper into transient issues and why the supervision model helps: https://ferd.ca/the-zen-of-erlang.html


I originally thought the same until I started building ML pipelines. The best would be a direct implementation of first class module systems to handle infrastructure.


Seriously? You’d rather let a whole container crash and respin and start all the services that will rebind again hoping that everything goes as planned in the restart? I’d rather have a language in which you can’t have null pointer exceptions and you handle everything that can possibly go wrong rather than write sloppy code that causes entire processes to crash, honestly.


But Erlang is a dynamic language...


There might be deeper trade concerns underlying the change in Delhi's stance, I do not think bureaucrats in the Indian government ever really created about privacy - its a convenient Casus Belli.

India mostly allowed free access to US tech companies for a while.

In exchange tech companies created a lot of middle class jobs in many indian cities.

But more importantly there seemed to an unwritten trade deal involving immigration.

Ever since Trump made his hardline immigration stance actionable, Indian consulting companies have taken a beating.

India's main dollar income source has been Indian working abroad.

It was an win win for US multi nationals, they got access to a large and growing market and also had access to cheap skilled labour.

It was also an win win for the upper middle class ( who really control the conversations ) in india, since they got access to US technology, better paid domestic software jobs and send their kids to the US.

In my own reading on India. They will crush any foreign company that tries to gain a monopoly market share - they did it with middle eastern telecom operators, and they will do it with US tech companies when its convenient. They rather their own billionaires have the monopoly.

There is nothing anybody else can do about it, since they have the numbers. So its really risky to invest large amount of capital in India, even if the average Indian is really thirty for capital and investment.

But I have noticed the average capitalist falls for India's trap time and again. I think it has to do with returns, if India was offering 20% RoR and companies were getting 2% RoR then as a CEO / manager I had to change my asset allocation regardless of future political risks involved.


> There might be deeper trade concerns underlying the change in Delhi's stance ...

Security. Sovereignty.

"Microsoft has been sharing Indian bank customers' data with U.S. intelligence agencies"

=> https://www.neowin.net/news/microsoft-has-been-sharing-india...


>They rather their own billionaires have the monopoly...

Just, Devil's Advocate here, but can you blame them?


>India mostly allowed free access to US tech companies for a while.

Tech companies allowed it as well because they wanted to capture Indian mindshare which would eventually become their largest customer base.


The Brits used to (and still do) capture indian mindshare and had them as their largest customer base - it didn't turn out well for indian national interest though.


Are you saying Indians chose to be "customers" of the British? I've heard a lot of interesting characterizations of the colonization and subsequent exploitation that was the bedrock of British India, but this one's new.


> Are you saying Indians chose to be "customers" of the British?

No.

India has a large domestic demand but it would be awful to allow non rupee denominated assets to supply that demand.

Imagine tomorrow India got rid of its strong tariff regime.

India's inflation is under control through making it punitive to buy foreign goods which India has a strong demand for.

The idea ever since Gandhi is to use domestic capabilities to provide services India demands. Domestic tariffs are also a form of coercion - but in this case it serves India's national interest.

With the Brits the main source of oppression was through preferential trade that tilted everything in their favour - either through hard power of soft ( like they still do today ).


You make some good points but alas many bad ones. The most glaring one is your hypothesis about Immigration: this has nothing to do with Trump whatsoever. Even if HRC was president and liberalized the immigration system, this would still happen. You haven't been following events in India closely enough; there are genuine concerns with services that most Indians use being owned/regulated by a non-Indian company, thus leading to a lack of the desired controls.

You can argue that it might be a bad idea to do that. However, as a Sovereign Nation, they do reserve the right to do whatever they want in their country.


Only applies to foreign investors that are trying to gain a permanent monopoly.

You cannot expect to invest 1 dollar to call dibs to control a growing nation.


> But “stop paying your debts” is a bad message imo.

Not really.

- Do you own a debt to your parents with a interest rate of 25% because they gave birth to you ?

- Do you own rent to planet earth for living in it ?

Debt can be unreasonable, just like wealth can be unreasonable. Its why governments intervene to destroy large amount of concentrated wealth and Egyptian pharaohs used to periodically clear everybody's debt.

The culture of " Paying your debt " is created by the small number of creditors who historically have controlled information flow, because they understand that society in aggregate has strong bargaining power.


You don't choose to be born. You choose to take out the loan. You sign forms telling you exactly how much it will cost you in the end. It's a decision. I can't imagine anyone saying "Let's all stop paying our Auto loans! They were unfair and predatory."

You made the decision. Own up to it. If you can't do the math at 18 years old you shouldn't be going to university anyways.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: