Tenetur itaque dolorum mollitia facere reprehenderit praesentium ullam. Accusantium id et illo ut eum. Dolore rerum qui sit eveniet ut nesciunt quam. Molestias fugiat omnis laborum quam.
Proxy vs VPN: 5 Crucial Differences You Must Know

Proxy vs VPN: 5 Crucial Differences You Must Know

These days, many internet users compare a proxy vs VPN, wondering what they should use when browsing to protect themselves.

In 2019, 84% of consumers said they cared about their privacy and data, and 80% were willing to act to protect it.

Virtual Private Networks (VPNs) and proxies are a potential solution because they add an extra layer between a browser and any data tracking company or government.

But what’s the difference between a proxy vs a VPN? Which option is best if you want to improve your privacy and safety online?

In this article, we’ll answer all your questions and highlight the crucial differences between the two.

What Is a Virtual Private Network (VPN)?

A virtual private network, or VPN, is a private network that encrypts any data sent to or received from the internet. It helps you securely and privately access websites and use your programs and apps, regardless of the network you’re using.

Think of it as a secure courier, taking website’s data from the website and delivering it securely to your computer. Just like an armored car would transport cash to and from an ATM.

It also hides your IP (here’s how to check your IP), and allows you to change your location so you can get access to geo-restricted content. Like if your favorite show isn’t available on Netflix in the country you’re visiting.

You can also access your company’s file system remotely with an “office IP address.”

A VPN works at the operating system level and encrypts all incoming and outgoing internet traffic.

How Does a VPN Work?

how a vpn works infographic

How a VPN works (Image source: yellowstonecomputing.com)

When communicating with the VPN server, the VPN client uses data encryption, which remotely accesses the website or data you have in mind.You get an intermediary on both sides. The client hides your query from your router and internet service provider (ISP), while the VPN server hides your identity from the webpage or service you’re using.

It makes a massive difference to security when you’re using any sort of public WiFi network. Online shopping, banking, or even sending work emails through an open network is a lot more secure with a VPN.

Since the VPN encrypts your connection, potential hackers can’t “eavesdrop” on the transmission to steal vulnerable data, like your account number, or worse, your password.

It also prevents your ISP or employer from spying on your traffic and what you’re doing online by tracking the router traffic.

If your company uses a VPN-enabled router, you can use a VPN to remotely connect to your office network and access office files, the CRM, or other software from the road.

What Is a Proxy Server?

A proxy server is typically a remote public server accessed through a web app or desktop program that accesses web pages on your behalf.

A proxy server works at the application level, acting as a proxy for a single app (like your browser) at a time.

Many proxy servers don’t support secure HTTPS data transfers, and are, by default, not secure.

How Does a Proxy Server Work?

When most people use the word proxy server, they mean HTTP proxies.

These proxy servers are web servers that access a webpage through the internet and then forward the data to your browser.

Proxy Server

How a proxy server works (Image source: seobility.net)

You can use these to access geo-restricted websites and pages in your browser.

Unlike a VPN, your proxy connection isn’t encrypted. It just acts as an intermediary between your computer and the final server.

As a result, an HTTP proxy will hide your identity from the website but won’t secure any sensitive data.

SOCKS5 Proxies

A SOCKS5 proxy works like HTTP or web proxies, but you can connect it to other applications, not just your web browser.

A SOCKS5 proxy restricts all data transfer to the 5th layer, effectively blocking attempts to tunnel or scan your system using common hacker tools.

Since you’re setting it up at the application level, the program itself must support proxy usage. It doesn’t control all incoming and outgoing traffic the way a VPN does. But you can use it for peer-to-peer file sharing, email, torrents, and more.

Transparent Proxies

A transparent proxy is a proxy set up on a network to control and monitor web traffic. It’s transparent because most users won’t notice that it’s there (until it blocks them from accessing a page).

Schools, offices, and even cafes use these to restrict access to certain websites, like social media or Netflix. Businesses may use one to keep you focused on your job or make sure you don’t use too much bandwidth.

/* Click to Tweet */
body a.novashare-ctt {
display: block;
background: #00abf0;
margin: 30px auto;
padding: 20px 20px 20px 15px;
color: #ffffff;
text-decoration: none !important;
box-shadow: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
border: none;
border-left: 5px solid #00abf0;
}
body a.novashare-ctt:hover {
color: #ffffff;
border-left: 5px solid #008cc4;
}
body a.novashare-ctt:visited {
color: #ffffff;
}
body a.novashare-ctt * {
pointer-events: none;
}
body a.novashare-ctt .novashare-ctt-tweet {
display: block;
font-size: 18px;
line-height: 27px;
margin-bottom: 10px;
}
body a.novashare-ctt .novashare-ctt-cta-container {
display: block;
overflow: hidden;
}
body a.novashare-ctt .novashare-ctt-cta {
float: right;
}
body a.novashare-ctt.novashare-ctt-cta-left .novashare-ctt-cta {
float: left;
}
body a.novashare-ctt .novashare-ctt-cta-text {
font-size: 16px;
line-height: 16px;
vertical-align: middle;
}
body a.novashare-ctt .novashare-ctt-cta-icon {
margin-left: 10px;
display: inline-block;
vertical-align: middle;
}
body a.novashare-ctt .novashare-ctt-cta-icon svg {
vertical-align: middle;
height: 18px;
}
/* Simple + Simple Alternate Themes */
body a.novashare-ctt.novashare-ctt-simple {
background: none;
padding: 10px 0px 10px 20px;
color: initial;
}
body a.novashare-ctt.novashare-ctt-simple-alt {
background: #f9f9f9;
padding: 20px;
color: initial;
}
body a.novashare-ctt.novashare-ctt-simple:hover, body a.novashare-ctt.novashare-ctt-simple-alt:hover {
border-left: 5px solid #008cc4;
}
body a.novashare-ctt.novashare-ctt-simple .novashare-ctt-cta, body a.novashare-ctt.novashare-ctt-simple-alt .novashare-ctt-cta {
color: #00abf0;
}
body a.novashare-ctt.novashare-ctt-simple:hover .novashare-ctt-cta, body a.novashare-ctt.novashare-ctt-simple-alt:hover .novashare-ctt-cta {
color: #008cc4;
}
Proxy vs VPN – what’s the difference, and most importantly, which one is best for privacy and safety?🔐 Click to see the full breakdown of these two solutions 🔍Click to Tweet

5 Key Differences Between a Proxy and a VPN

With just the technical definitions, it can be challenging for an average user to tell a VPN apart from a proxy. To help you understand how a VPN is different from a proxy server, we’ve highlighted the major differences comparing VPNs with proxies regarding security, privacy, cookies, cost, and speed.

1. Proxy vs VPN: Security

93% of data breaches could have been avoided through fundamental data security efforts. For a private person, that usually means taking a few extra precautions when browsing the internet.

Especially when using the internet from a public network. But which option is the best choice when it comes to improving your security?

Let’s start by taking a closer look at proxy servers.

Are Proxies Safe?

The short answer is: probably not. Especially if you favor proxy servers because they tend to be free, as opposed to VPNs.

Public, unencrypted proxy servers hide your identity from the website you’re visiting. But they do nothing to encrypt your connection to the proxy server itself.

By using a public proxy server, you risk ending up with a less secure connection than by just connecting to a web server directly through your browser.

good and bad proxies chart

Good vs bad proxies

In a landmark study of over 13,000 proxies, 79%% of the tested public proxy servers were either not safe, with no HTTPS traffic allowed, or directly harmful with injected HTML or JavaScript.

Paid proxy servers with HTTPS connections and password protection are usually safe. But they’re still limited compared to the end-to-end encryption you get with a professional-grade VPN.

Next, let’s take a closer look at VPNs and how they impact your security.

Are VPNs Safe?

Yes, the vast majority of commercial VPNs are safe to use. A VPN loads the data on the server-end and then encrypts the data before sending it to the client on your computer.

Only after the data has been sent through to the client does it decrypt the data for other programs to use. So not only is your identity hidden from the website or service you visit, your ISP, or even the network doesn’t know what data you’re loading either.

All they can see is that you’re loading encrypted data from a VPN. It protects your data from any malicious hackers on an open network, as well as the prying eyes of the government or your employer.

It will also protect your IP address from getting revealed, protecting your computer from DDoS attacks and other brute force attacks.

All this protection may sound like a lengthy process, but it all happens in microseconds. It doesn’t significantly impact your browsing experience. You can even stream movies in HD without any lag or play online games without latency issues.

The only caveat is that a VPN service is only as reliable as its provider. So you should do your due diligence when choosing a VPN.

Remember that you’re giving a company full access to your internet traffic. Choose a VPN provider with a stellar reputation and good privacy practices.

2. Proxy vs VPN: Privacy

74% of Americans have limited their online activity due to privacy concerns.

Locally installed VPNs offer complete encryption of your data from the moment it leaves your computer until its destination. That means it’s a lot harder for people to spy on your data.

Even if you’re on an open WIFI network, the encryption protects your data from being intercepted by malicious hackers.

And since the VPN uses end-to-end encryption, your ISP, router, employer, or government can’t access your data either.

That’s part of the reason why the Chinese government is trying to restrict the public’s access to VPNs. Because when even the ISP can’t snoop on the traffic, there’s no way to control if you’re accessing blocked websites or not.

VPNs will also hide your IP address and location from the website you visit, making it harder to identify you.

Proxy servers just act as a go-between and hide your IP address from the web server you visit.

Even with a VPN or proxy, you’ll still be vulnerable to device fingerprinting and other techniques used by scrupulous advertisers to show “relevant” ads.

But by hiding your IP address, you at least make it harder for companies to connect the dots.

3. Proxy vs VPN: Cookies

With laws (like GDPR and CCPA) and the increased focus on internet privacy, many consumers are concerned about how sites and advertisers use cookies to track their every move.

GDPR compliance is one of the new hot topics in the EU business world. And with good reason. Because of this new law, virtually every website that tracks you with cookies has to ask for your permission.

The Guardian cookie prompt

The Guardian cookie prompt

You’ve probably seen prompts like these hundreds of times now.

And here’s the thing about cookies, they’re stored and saved on your computer’s hard drive. Cookies will get downloaded to your computer through the proxy server or VPN.

But with a VPN, the cookie will mistake the VPN’s IP address for your own, which will offer some level of protection against fingerprinting and other digital tracking techniques.

A proxy server will also trick the website into storing a cookie with a different IP address.

So when you start using a VPN or proxy server, you must clear all the cookies on your computer.

If not, existing cookies may interfere with the added layer of privacy. The site will connect it with your original location and IP address and use it to aid in your device’s fingerprinting.

4. Proxy vs VPN: Cost

We’ll look into a few solutions further down the blog post, but as for now, you should know that most available proxies are public and free, while VPN services typically cost between $5 and $12 per month.

If you want to use a proxy server safely, you’ll need to use a reliable premium service as well. Premium SOCKS5 proxy provider IPVanish costs $5 per month, and other alternatives price themselves similarly.

So if you’re serious about security, a VPN still offers the best bang for your buck.

5. Proxy vs VPN: Connection Speed

Another key difference between a proxy and a VPN is the speed of the connection.

With a public proxy server, you may struggle to even get a single megabit per second, while some VPNs offer speeds of 50 Mbps or higher.

While the encryption of a VPN may add a few milliseconds of latency, it isn’t noticeable unless you’re a professional gamer or streamer at the highest level.

In some cases, using a VPN can even speed up your connection. Most major providers use a network of data centers around the world. So if the site doesn’t use a CDN, or the CDN’s closest data center is far away, a VPN connection may be faster.

3 Secure Premium VPNs You Can Start Using Today for Safer Browsing (And One Free Option)

To take your data security seriously, you can use one of these VPN solutions to start browsing safer today.

1. ExpressVPN

express vpn

ExpressVPN VPN service

If you listen to podcasts or watch any major YouTubers, chances are you’ve already heard of ExpressVPN.

Struggling with downtime and WordPress issues? Kinsta is the hosting solution designed with performance and security in mind! Check out our plans

It’s one of the biggest VPN service providers globally, and definitely, the most heavily advertised one. But it’s not just ad dollars that ExpressVPN has going for it. Its large budget and customer base also mean it has a robust offering with over 3,000 VPN servers.

ExpressVPN doesn’t limit your bandwidth, and fast servers mean you can see download speeds as high as 50 Mbps or higher, depending on your internet connection and location.

ExpressVPN costs $12.95/month billed monthly, and $8.32/month billed annually.

  • Connection speed: 50 Mbps+
  • Bandwidth: Unlimited
  • Trustpilot rating: 4.7 out of 5, with 6,100+ reviews
  • Device limit: Up to 5 devices
  • Price: $12.95/month
  • Free trial: None

2. NordVPN

NordVPN VPN service

NordVPN VPN service

NordVPN is another market leader in the VPN space and with good reason.

NordVPN has repeatedly tested as the fastest VPN available for US users and has over 5,000 servers in 60+ different countries.

It often offers giant sales on annual plans, making it one of the cheaper VPN services on the market. On top of these, you have the seasonal Black Friday / Cyber Monday deals (if you run an ecommerce, make sure to check out our webinar with WooCommerce agency Sau/Cal on the topic).

NordVPN offers also a 30-day money-back guarantee.

  • Connection speed: 50 Mbps+
  • Bandwidth: Unlimited
  • Trustpilot rating: 4.4 out of 5, with 4,955+ reviews
  • Price: $11.95/month
  • Device limit: Up to 6 devices
  • Free trial: Yes

3. Surfshark

Surfshark VPN service

Surfshark VPN service

Surfshark is another great VPN service that boasts a fast, reliable connection, regardless of where you are in the world.

SurfShark has over 1,700 server locations in more than 63 different countries. Bandwidth and devices are unlimited with a single plan, which is something somewhat uncommon for VPN providers. This VPN solution comes also with a built-in ad blocker feature.

At $12.95 euros per month, the price is roughly the same as ExpressVPN’s.

  • Connection speed: 40 Mbps+
  • Bandwidth: Unlimited
  • Trustpilot rating: 4.3 out of 5, with 6,410+ reviews
  • Price: $12.95/month (special deals run every year for seasonal events like Black Friday / Cyber Monday)
  • Device limit: None
  • Free trial: None

Free Option: ProtonVPN

ProtonVPN free VPN service

ProtonVPN free VPN service

ProtonVPN offers a 100% free and ad-free plan that supports one device and up to three countries.

The free plan also protects your privacy, with a policy of maintaining 0 logs of any user activity and browsing.

Bandwidth and speed are technically unlimited, but since you’re using crowded free servers, the speeds are comparatively slower.

The premium plan includes 1,077 servers in 50 countries, but some users report slow speeds for popular locations and servers like the US.

The customer reputation isn’t as good as the three alternatives mentioned above.

  • Connection speed: 20 Mbps+ (Free plan)
  • Bandwidth: Unlimited (Free plan)
  • Trustpilot rating: 3.0 out of 5, with  54 reviews
  • Price: Free plan. Starting at $4/month
  • Device limit: 1 device on the Free plan

 

Proxy vs VPN: FAQs

Do You Need a Proxy If You Have a VPN?

No, you don’t need a proxy server if you’re using a VPN currently. The VPN is already masking your IP address from the servers you access. Also, it encrypts the data and hides it from your ISP and potential hackers.

Can I Use a VPN and Proxy Together?

Yes, technically, it’s possible to use both at the same time. But it’s not necessary and won’t have any significant impact on your security. Instead, it’s likely to drastically slow down your connection, increase latency, and ruin your browsing experience.

Can Proxies Be Traced?

A proxy server will hide your IP address from websites and services that you visit. Someone may still identify your computer or device with fingerprinting, but that’s unrelated to the proxy.

Does a Proxy Hide Your IP?

Yes, both proxy servers and VPNs hide your IP address from websites and services that you visit and use.

Are There Any Free Proxy Servers?

There are thousands of free proxy servers available online, but many are unsafe, slow, or unreliable.

Should I Use a Free Proxy Server?

If you care about your connection’s speed, reliability, and security, a free proxy server isn’t the right choice. Instead, opt for a premium VPN service or proxy.

If you just want to access geo-restricted content, then a free proxy server might be enough.

When it comes to keeping yourself safe and secure online, proxies and VPNs are two words you hear a lot – but what’s the difference? 🔐 This guide dives deep into the privacy concerns of both solutions.Click to Tweet

Summary

When it comes to security and privacy, a public proxy server is no match for a premium, encrypted VPN. A VPN costs some money, sure, but it makes up for that in reliability, security, privacy, and connection speed.

Securing your web traffic isn’t just a matter of accessing geo-blocked streaming content. It could also have deeper ramifications into the freedom to gather or share information that’s not accessible in someone’s country.

Do you use a VPN to improve your privacy and security when browsing the internet? What’s your experience?

The post Proxy vs VPN: 5 Crucial Differences You Must Know appeared first on Kinsta.

Communication & Covid 19 : les laboratoires pharmaceutiques sur le fil du rasoir

La course au vaccin du Covid-19 s’accélère avec des annonces retentissantes de plusieurs laboratoires pharmaceutiques. Le taux d’efficacité des premiers vaccins actuellement en phase 3 est très encourageant. Néanmoins, la communication des industriels doit marcher sur des œufs. L’acceptabilité de la vaccination reste délicate, notamment en France et le secteur pharmaceutique éveille toujours beaucoup de […]

The Economist Who Would Fix the American Dream

The Economist Who Would Fix the American Dream

Updated at 3:47 p.m. ET on July 17, 2019.

Raj Chetty got his biggest break before his life began. His mother, Anbu, grew up in Tamil Nadu, a tropical state at the southern tip of the Indian subcontinent. Anbu showed the greatest academic potential of her five siblings, but her future was constrained by custom. Although Anbu’s father encouraged her scholarly inclinations, there were no colleges in the area, and sending his daughter away for an education would have been unseemly.

To hear more feature stories, see our full list or get the Audm iPhone app.

But as Anbu approached the end of high school, a minor miracle redirected her life. A local tycoon, himself the father of a bright daughter, decided to open a women’s college, housed in his elegant residence. Anbu was admitted to the inaugural class of 30 young women, learning English in the spacious courtyard under a thatched roof and traveling in the early mornings by bus to a nearby college to run chemistry experiments or dissect frogs’ hearts before the men arrived. Anbu excelled, and so began a rapid upward trajectory. She enrolled in medical school. “Why,” her father was asked, “do you send her there?” Among their Chettiar caste, husbands commonly worked abroad for years at a time, sending back money, while wives were left to raise the children. What use would a medical degree be to a stay-at-home mother?

In 1962, Anbu married Veerappa Chetty, a brilliant man from Tamil Nadu whose mother and grandmother had sometimes eaten less food so there would be more for him. Anbu became a doctor and supported her husband while he earned a doctorate in economics. By 1979, when Raj was born in New Delhi, his mother was a pediatrics professor and his father was an economics professor who had served as an adviser to Prime Minister Indira Gandhi.

When Chetty was 9, his family moved to the United States, and he began a climb nearly as dramatic as that of his parents. He was the valedictorian of his high-school class, then graduated in just three years from Harvard University, where he went on to earn a doctorate in economics and, at age 28, was among the youngest faculty members in the university’s history to be offered tenure. In 2012, he was awarded the MacArthur genius grant. The following year, he was given the John Bates Clark Medal, awarded to the most promising economist under 40. (He was 33 at the time.) In 2015, Stanford University hired him away. Last summer, Harvard lured him back to launch his own research and policy institute, with funding from the Bill & Melinda Gates Foundation and the Chan Zuckerberg Initiative.

Chetty turns 40 this month, and is widely considered to be one of the most influential social scientists of his generation. “The question with Raj,” says Harvard’s Edward Glaeser, one of the country’s leading urban economists, “is not if he will win a Nobel Prize, but when.”

The work that has brought Chetty such fame is an echo of his family’s history. He has pioneered an approach that uses newly available sources of government data to show how American families fare across generations, revealing striking patterns of upward mobility and stagnation. In one early study, he showed that children born in 1940 had a 90 percent chance of earning more than their parents, but for children born four decades later, that chance had fallen to 50 percent, a toss of a coin.

In 2013, Chetty released a colorful map of the United States, showing the surprising degree to which people’s financial prospects depend on where they happen to grow up. In Salt Lake City, a person born to a family in the bottom fifth of household income had a 10.8 percent chance of reaching the top fifth. In Milwaukee, the odds were less than half that.

 Image of 5ce0e099d
Chetty at age 9. He was later valedictorian of his high school, and he went on to earn an undergraduate degree and a doctorate in economics from Harvard University. At age 28, he was among the youngest faculty members in the university’s history to be offered tenure. (Courtesy of Raj Chetty)

Since then, each of his studies has become a front-page media event (“Chetty bombs,” one collaborator calls them) that combines awe—millions of data points, vivid infographics, a countrywide lens—with shock. This may not be the America you’d like to imagine, the statistics testify, but it’s what we’ve allowed America to become. Dozens of the nation’s elite colleges have more children of the 1 percent than from families in the bottom 60 percent of family income. A black boy born to a wealthy family is more than twice as likely to end up poor as a white boy from a wealthy family. Chetty has established Big Data as a moral force in the American debate.

Now he wants to do more than change our understanding of America—he wants to change America itself. His new Harvard-based institute, called Opportunity Insights, is explicitly aimed at applying his findings in cities around the country and demonstrating that social scientists, despite a discouraging track record, are able to fix the problems they articulate in journals. His staff includes an eight-person policy team, which is building partnerships with Charlotte, Seattle, Detroit, Minneapolis, and other cities.

For a man who has done so much to document the country’s failings, Chetty is curiously optimistic. He has the confidence of a scientist: If a phenomenon like upward mobility can be measured with enough precision, then it can be understood; if it can be understood, then it can be manipulated. “The big-picture goal,” Chetty told me, “is to revive the American dream.”

Last summer, I visited Opportunity Insights on its opening day. The offices are housed on the second floor of a brick building, above a café and across Massachusetts Avenue from Harvard’s columned Widener Library. Chetty arrived in econ-casual: a lilac dress shirt, no jacket, black slacks. He is tall and trim, with an untroubled air; he smiled as he greeted two of his longtime collaborators—the Brown University economist John Friedman and Harvard’s Nathaniel Hendren. They walked him around, showing off the finished space, done in a modern palette of white, wood, and aluminum with accent walls of yellow and sage.

Later, after Chetty and his colleagues had finished giving a day of seminars to their new staff, I caught up with him in his office, which was outfitted with a pristine whiteboard, an adjustable-height desk, and a Herman Miller chair that still had the tags attached. The first time I’d met him, at an economics conference, he had told me he was one of several cousins on his mother’s side who go by Raj, all named after their grandfather, Nadarajan, all with sharp minds and the same long legs and easy gait. Yet of Nadarajan’s children, only Chetty’s mother graduated from college, and he’s certain that this fact shaped his generation’s possibilities. He was able to come to the United States as a child and attend an elite private school, the University School of Milwaukee. New York Raj—the family appends a location to keep them straight—came to the U.S. later in life, at age 28, worked in drugstores, and then took a series of jobs with the City of New York. Singapore Raj found a job in a temple there that allows him to support his family back in India, but means they must live apart. Karaikudi Raj, named for the town where his mother grew up, committed suicide as a teenager.

I asked Boston Raj to consider what might have become of him if that wealthy Indian businessman had not decided, in the precise year his mother was finishing high school, to create a college for the talented women of southeastern Tamil Nadu. “I would likely not be here,” he said, thinking for a moment. “To put it another way: Who are all the people who are not here, who would have been here if they’d had the opportunities? That is a really good question.”

Charlotte is one of America’s great urban success stories. In the 1970s, it was a modest-size city left behind as the textile industry that had defined North Carolina moved overseas. But in the 1980s, the “Queen City” began to lift itself up. US Airways established a hub at the Charlotte Douglas International Airport, and the region became a major transportation and distribution center. Bank of America built its headquarters there, and today Charlotte is in a dead heat with San Francisco to be the nation’s second-largest banking center, after New York. New skyscrapers have sprouted downtown, and the city boundary has been expanding, replacing farmland with spacious homes and Whole Foods stores. In the past four decades, Charlotte’s population has nearly tripled.

Charlotte has also stood out in Chetty’s research, though not in a good way. In a 2014 analysis of the country’s 50 largest metropolitan areas, Charlotte ranked last in ability to lift up poor children. Only 4.4 percent of Charlotte’s kids moved from the bottom quintile of household income to the top. Kids born into low-income families earned just $26,000 a year, on average, as adults—perched on the poverty line. “It was shocking,” says Brian Collier, an executive vice president of the Foundation for the Carolinas, which is working with Opportunity Insights. “The Charlotte story is that we are a meritocracy, that if you come here and are smart and motivated, you will have every opportunity to achieve greatness.” The city’s true story, Chetty’s data showed, is of selective opportunity: All the data-scientist and business-development-analyst jobs in the thriving banking sector are a boon for out-of-towners and the progeny of the well-to-do, but to grow up poor in Charlotte is largely to remain poor.

To help cities like Charlotte, Chetty takes inspiration from medicine. For thousands of years, he explained, little progress was made in understanding disease, until technologies like the microscope gave scientists novel ways to understand biology, and thus the pathologies that make people ill. In October, Chetty’s institute released an interactive map of the United States called the Opportunity Atlas, revealing the terrain of opportunity down to the level of individual neighborhoods. This, he says, will be his microscope.

Drawing on anonymized government data over a three-decade span, the researchers linked children to the parents who claimed them as dependents. The atlas then followed poor kids from every census tract in the country, showing how much they went on to earn as adults. The colors on the atlas reveal a generation’s prospects: red for areas where kids fared the worst; shades of orange, yellow, and green for middling locales; and blue for spots like Salt Lake City’s Foothill neighborhood, where upward mobility is strongest. It can also track children born into higher income brackets, compare results by race and gender, and zoom out to show states, regions, or the country as a whole.

The Opportunity Atlas has a fractal quality. Some regions of the United States look better than high-mobility countries such as Denmark, while others look more like a developing country. The Great Plains unfurl as a sea of blue, and then the eye is caught by an island of red—a mark of the miseries inflicted on the Oglala Lakota by European settlers. These stark differences recapitulate themselves on smaller and smaller scales as you zoom in. It’s common to see opposite extremes of opportunity within easy walking distance of each other, even in two neighborhoods that long-term residents would consider quite similar.

To find a cure for what ails America, Chetty will need to understand all of this wild variation. Which factors foster opportunity, and which impede it? The next step will be to find local interventions that can address these factors—and to prove, with experimental trials, that the interventions work. The end goal is the social equivalent of precision medicine: a method for diagnosing the particular weaknesses of a place and prescribing a set of treatments. This could transform neighborhoods, and restore the American dream from the ground up.

If all of this seems impossibly ambitious, Chetty’s counterargument is to point to how the blue is marbled in with the red. “We are not trying to do something that is unimaginable or has never happened,” he told me over lunch one day. “It happens just down the road.”

Yet in Charlotte, where Opportunity Insights hopes to build its proof of concept, the atlas reveals swaths of bleak uniformity. Looking at the city, you first see a large bluish wedge south of downtown, with Providence Road on one side and South Boulevard on the other, encompassing the mostly white, mostly affluent areas where children generally grow up to do well. Surrounding the wedge is a broad expanse in hues of red that locals call “the crescent,” made up of predominantly black neighborhoods where the prospects for poor children are pretty miserable. Hunger and homelessness are common, and in some places only one in five high-school students scores “proficient” on standardized tests. In many parts of the crescent, the question isn’t What’s holding kids back? so much as What isn’t holding them back? It’s hard to know where to start.

The most significant challenge Chetty faces is the force of history. In the 1930s, redlining prevented black families from buying homes in Charlotte’s more desirable neighborhoods. In the 1940s, the city built Independence Boulevard, a four-lane highway that cut through the heart of its Brooklyn neighborhood, dividing and displacing a thriving working-class black community. The damage continued in the ’60s and ’70s with new interstates. It’s common to hear that something has gone wrong in parts of Charlotte, but the more honest reading is that Charlotte is working as it was designed to. American cities are the way they are, and remain the way they are, because of choices they have made and continue to make.

Does a professor from Harvard, even one as influential and well funded as Chetty, truly stand any chance of bending the American story line? On his national atlas, the most obvious feature is an ugly red gash that starts in Virginia, curls down through the Southeast’s coastal states—North Carolina, South Carolina, Georgia, and Alabama—then marches west toward the Mississippi River, where it turns northward before petering out in western Tennessee. When I saw this, I was reminded of another map: one President Abraham Lincoln consulted in 1861, demarcating the counties with the most slaves. The two maps are remarkably similar. Set the documents side by side, and it may be hard to believe that they are separated in time by more than a century and a half, or that one is a rough census of men and women kept in bondage at the time of the Civil War, and the other is a computer-generated glimpse of our children’s future.

 Image of 8941221b5
Top: A map consulted by President Lincoln in 1861, demarcating the counties with the most slaves. (Library of Congress)

Bottom: A detail from Chetty’s Opportunity Atlas, in which areas with poor upward mobility are shown in red. The similarities between the two documents suggest that it will be difficult for Chetty to change the landscape of opportunity. (Opportunity Insights / U.S. Census Bureau)

In 2003, after earning his doctorate, Chetty moved to UC Berkeley for his first job. He was, at the time, the only person in his immediate family—his parents and two older sisters, both biomedical researchers—who had not published a paper. Education was highly prized. He was taught that it would be sacrilege to ever step on a book. When he visits his parents at their home, north of Boston, his mother still makes him a favorite dish with bhindi (Hindi for “okra”), which, she told me, is supposed to be good for the brain.

Both of Chetty’s parents descend from the Chettiar caste, a mercantile group historically involved in banking, and the kids were raised to carry on their cultural heritage. They learned Tamil in addition to Hindi. Chetty’s sisters married men with Chettiar backgrounds. Chetty rejects the caste system, though he first met his wife, Sundari, after one of his sisters got to know her through the Chettiar community. (Sundari is a stem-cell biologist.)

Chetty had always been drawn to public economics—the study of government policy and how it might be improved. And, as it happened, he was embarking on his career as a revolution in the field was under way. In the past, economists had to rely heavily on surveys, but the advent of cheap, powerful computing allowed for a new kind of economics—one that drew on the extensive administrative data gathered by governments. Survey participants number in the hundreds or thousands; administrative data can yield records in the hundreds of millions.

In November 2007, Chetty came across an ad from the IRS seeking help organizing its electronic files into a format that would be easier to use for research. He immediately recognized that completing the job would make it possible for scholars to go far deeper into tax data. He and John Friedman began the process of registering to be federal contractors—which involved, among other things, certifying that their workplace met federal safety standards, and calling on Friedman’s brother, who lived in Washington, D.C., to take a cab out to Maryland to hand-deliver their application materials, in triplicate.

Like many good ideas, the project seems obvious in retrospect, but the truth is that nobody could have known how useful the data would prove to be—and it worked only because Chetty and his colleagues have an almost superhuman degree of patience.

Nathaniel Hendren, who has known Chetty for seven years, told me he’s never seen Chetty happier than one Friday evening in the summer of 2014, when they were sitting in some IRS cubicles at the John F. Kennedy Federal Building in downtown Boston. (The only way to access the government’s data was inside a federal building, on secure servers, with the computers logging their requests.) That night, Chetty and Hendren were wrestling with thousands of lines of code designed to pull together responses scattered across hundreds of millions of 1040s, W2s, and other forms (taxpayer names are kept separate to protect privacy), while ensuring that nothing in the code introduced errors or subtle biases. At some point, Hendren recalled, he heard Chetty yell “Sweet!” Hendren looked over and Chetty, smiling, explained that his flight out of Logan airport that night had just been delayed: more time to work.

Over the past two decades, economists have tried to structure their work, as much as possible, to resemble scientific experiments. This “credibility revolution” is an attempt to explicitly link causes to effects, and sweep aside the old criticism that correlation is not the same as causation. One of the advantages of the large tax database Chetty and his colleagues constructed is that it allows “quasi-experiments”—clever statistical methods that approach the power of a true experiment without requiring a researcher to, say, randomly assign children to live in different cities.

For example, Chetty and Hendren looked at children who changed cities. They found that the later a child moved to a higher-opportunity area, the less effect the move seemed to have on future earnings. But they also devised additional tests to ensure that the effect was causal, such as looking at siblings who moved at the same time: a quasi-experiment in which two children grew up in the same family, but were exposed to a new area for a shorter or longer period depending on their age at the time of the move. The result was a highly credible conclusion, based on millions of data points, that moving a child to a better neighborhood boosts his or her future income—and the younger the child, the greater the benefit.

There was, however, a significant problem: Their conclusion contradicted one of the most influential poverty experiments of recent decades. In the 1990s, the federal government launched Moving to Opportunity, a program designed to relocate families living in public housing to safer neighborhoods, where they had access to better jobs and schools. Thousands of families in five cities were randomly selected to receive housing vouchers and support services to help them move to lower-poverty areas. After a decade of study, researchers concluded that while these “mover” families experienced some physical and mental-health benefits, test scores among the kids didn’t rise, and there were no signs of financial benefit for adults or older children.

In 2014, Chetty, Hendren, and the Harvard economist Lawrence Katz asked the IRS and the Department of Housing and Urban Development, which had overseen the program, for permission to take another look at what had happened to the children. When the earlier follow-up had been done, the youngest kids, who had moved before they were teenagers, had not yet reached their earning years, and this turned out to make all the difference. This young group of movers, the economists found, had gone on to earn 31 percent more than those who hadn’t moved, and 4 percent more of them attended college. They calculated that for an 8-year-old child, the value of the extra future earnings over a lifetime was almost $100,000, a substantial sum for a poor family. For a family with two children, the taxes paid on the extra income more than covered the costs of the program. “The big insight,” Kathryn Edin, a sociology professor at Princeton, told me, “is that it took a generation for the effects to manifest.”

Last July, I took a tour of Charlotte with David Williams, the 34-year-old policy director of Opportunity Insights and the man responsible for translating Chetty’s research into action on the ground. Williams and members of his team crammed into the back of a white Ford Explorer with color printouts of various Charlotte neighborhoods as they appear on the atlas. Brian Collier, of the Foundation for the Carolinas, sat in the front seat, serving as a guide.

As the driver headed northeast, the high-rises of “Uptown” shifted abruptly to low-slung buildings and chain-link fences. Collier pointed out a men’s shelter in the rapidly gentrifying neighborhood of Lockwood, where he’d recently seen a drug deal go down a block away from a house that had sold for half a million dollars.

We continued on to Brightwalk, a new mixed-income development with long rows of townhomes, before turning west for a loop around West Charlotte High School, a once-lauded model of successful integration. In the 1990s, though, support for busing waned, and in 1999, a judge declared that race could not be used as a factor in school assignment. Now the student population is virtually all minority and overwhelmingly poor, and the surrounding neighborhood is deep red on the atlas. The homes are neat, one-story single families, a tad rough around the edges but nothing like the burnt-out buildings in Detroit, where Williams previously worked on economic development for the mayor. “It reminds you how hard it is to tell where real opportunity is,” Williams said. “You can’t just see it.”

Opportunity is not the same as affluence. Consider a kid who grows up in a household earning about $27,000 annually, right at the 25th percentile nationally. In Beverly Woods, a relatively wealthy, mostly white enclave in South Charlotte with spacious, well-kept yards, he could expect his household income to be $42,900 by age 35. Yet in Huntersville, an attractive northern suburb with nearly the same average household income as Beverly Woods, a similar kid could expect only $24,800—a stark difference, invisible to a passing driver.

This dynamic also functions in poorer areas. For a child in Reid Park, an African American neighborhood on the west side of Charlotte, near the airport—a place that has struggled to recover from a crime epidemic in the 1980s—the expected household income at age 35 is a dismal $17,800, on average. But in East Forest, a white, working-class neighborhood in southeast Charlotte, the expected future income jumps to $32,600.

There are places like East Forest in cities around the country. Chetty and his team have taken to calling them “opportunity bargains”: places with relatively affordable rents that punch above their weight with respect to opportunity. He doesn’t yet know why some places are opportunity bargains, but he considers the discovery of these neighborhoods to be a breakthrough. John Friedman told me that if the government had been able to move families to opportunity-bargain neighborhoods in the original Moving to Opportunity experiment—places selected for higher opportunity, not lower poverty—the children’s earnings improvements would have been more than twice as great.

Chetty’s team has already begun to apply this concept in another of its partner cities, Seattle, working with two local housing authorities to navigate the thorny process of translating research into measurable social change. It’s hard for poor families to manage an expansive housing search, which requires time, transportation, and decent credit. The group created a program with “housing navigators,” who point participants toward areas with relatively high opportunity, help with credit-related issues, and even give neighborhood tours. Landlords need encouragement as well. They can be wary of tenants bearing vouchers, which mean government oversight and paperwork. The Seattle program has streamlined this process, and offers free damage insurance to sweeten the deal.

Tenants have just started moving, but the program is already successful: The majority of families who received assistance moved to high-opportunity areas, compared with one-fifth for the control group, which was not provided with the extra services. Chetty estimates that the program will increase each child’s lifetime earnings by $88,000. In February, President Donald Trump signed into law a bill that provides $28 million to try similar experimental programs in other locations. The bill enjoyed overwhelming bipartisan support, and this spring Chetty was invited to brief the Department of Housing and Urban Development. He told me he’s hopeful that the program can be expanded to the 2.2 million families that receive HUD housing vouchers every year. “Then you’d actually be doing something about poverty in the American city,” he said. “What I like about this is it’s not some pie-in-the-sky thing. We have something that works.”

Charlotte is among the cities interested in implementing the Seattle strategy, but officials also want to use the atlas to select better building sites for affordable housing. In the past, much of the city’s affordable housing was constructed in what Chetty’s data reveal to be high-poverty, low-opportunity areas. “Let’s not just think about building X units of new affordable housing,” Williams said. “Let’s really leverage housing policy as part of a larger economic-mobility agenda for the community.”

Opportunity bargains, however, are not an inexhaustible resource. The crucial question, says the Berkeley economist Enrico Moretti, is whether the opportunity in these places derives from “rival goods”—institutions, such as schools, with limited capacity—or “non-rival goods,” such as local culture, which are harder to deplete. When new people move in, what happens to opportunity? And even if an influx of families doesn’t disrupt the opportunity magic, people aren’t always eager to pick up and leave their homes. Moving breaks ties with family, friends, schools, churches, and other organizations. “The real conundrum is how to address the larger structural realities of inequality,” says the Harvard sociologist Robert Sampson, “and not just try to move people around.”

For all he’s learned about where opportunity resides in America, Chetty knows surprisingly little about what makes one place better than another. He and Hendren have gathered a range of social-science data sets and looked for correlations to the atlas. The high-opportunity places, they’ve found, tend to share five qualities: good schools, greater levels of social cohesion, many two-parent families, low levels of income inequality, and little residential segregation, by either class or race. The list is suggestive, but hard to interpret.

For example, the strongest correlation is the number of intact families. The explanation seems obvious: A second parent usually means higher family income as well as more stability, a broader social network, additional emotional support, and many other intangibles. Yet children’s upward mobility was strongly correlated with two-parent families only in the neighborhood, not necessarily in their home. There are so many things the data might be trying to say. Maybe fathers in a neighborhood serve as mentors and role models? Or maybe there is no causal connection at all. Perhaps, for example, places with strong church communities help kids while also fostering strong marriages. The same kinds of questions flow from every correlation; each one may mean many things. What is cause, what is effect, and what are we missing? Chetty’s microscope has revealed a new world, but not what animates it—or how to change it.

Chetty has found that opportunity does not correlate with many traditional economic measures, such as employment or wage growth. In the search for opportunity’s cause, he is instead focusing on an idea borrowed from sociology: social capital. The term refers broadly to the set of connections that ease a person’s way through the world, providing support and inspiration and opening doors.

 Image of 9a8716660
Chetty believes that if upward mobility can be measured with enough precision, it can be understood. “The big-picture goal,” he told me, “is to revive the American dream.” (​Carlos Chavarría)

Economics has long played the role of sociology’s annoying older brother—conventionally accomplished and wholeheartedly confident, unaware of what he doesn’t know, while still commanding everyone’s attention. Chetty, though, is part of a younger generation of scholars who have embraced a style of quantitative social science that crosses old disciplinary lines. There are strong hints in his research that social capital and mobility are intimately connected; even a crude measure of social capital, such as the number of bowling alleys in a neighborhood, seems to track with opportunity. His data also suggest that who you know growing up can have lasting effects. A paper on patents he co-authored found that young women were more likely to become inventors if they’d moved as children to places where many female inventors lived. (The number of male inventors had little effect.) Even which fields inventors worked in was heavily influenced by what was being invented around them as children. Those who grew up in the Bay Area had some of the highest rates of patenting in computers and related fields, while those who spent their childhood in Minneapolis, home of many medical-device manufacturers, tended to invent drugs and medical devices.* Chetty is currently working with data from Facebook and other social-media platforms to quantify the links between opportunity and our social networks.

Sociologists embrace many ways of understanding the world. They shadow people and move into communities, wondering what they might find out. They collect data and do quantitative analysis and read economics papers, but their work is also informed by psychology and cultural studies. “When you are released from the harsh demands of experiment, you are allowed to make new discoveries and think more freely about what is going on,” says David Grusky, a Stanford sociology professor who collaborates with Chetty. I asked Princeton’s Edin what she thought would end up being the one thing that best explains the peaks and valleys of American opportunity. She said her best guess is “some kind of social glue”—the ties that bind people, fostered by well-functioning institutions, whether they are mosques or neighborhood soccer leagues. The staff at Opportunity Insights has learned: When an economist gets lost, a sociologist can touch his elbow and say, You know, I’ve been noticing some things.

In Charlotte, Chetty still aspires to practice “precision medicine,” but he told me his initial goal is more modest: to see whether he and his team can find anything that helps. Opportunity Insights is planning housing and higher-education initiatives, but social capital is at the center of its approach. It is working with a local organization called Leading on Opportunity, and looking at nonprofits that are already operating successfully, including Communities in Schools, a national group that provides comprehensive student support, as well as a job-training program called Year Up. Chetty is also using tax data to measure the long-term impacts of dozens of place-based interventions, such as enterprise zones, which use tax and other incentives to draw businesses into economically depressed areas. (He expects to see initial results from these analyses later this year.) Chetty may not have many answers yet, but he is convinced that this combination of data, collaboration, and fieldwork will make it possible to move from educated guesses to tailored prescriptions. “There are points when the pieces come together,” Chetty told me. “My instinct is that in social science, this generation is when that is going to happen.”

Chetty’s pitch to the nation is that our problems have technocratic solutions, but at times I sense that he is avoiding an argument. Surely our neighborhoods can be improved, and those improvements can help the next generation achieve better outcomes. But what of the larger forces driving the enormous disparities in American wealth? Poor people would be better off if their children had better prospects, but also if they had more money—if the fruits of our society were shared more broadly. “I can take money from you and give it to me, and maybe that is good and maybe it is not,” he said. “I feel like there are a lot of people working on redistribution, and it is hard to figure out the right answer there.” To focus on the question of who gets what is also, of course, politically incendiary.

Chetty believes there is more progress to be made through a moral framing that is less partisan. “There are so many kids out there who could be doing so many great things, both for themselves and for the world,” he said. Chetty’s challenge to the system is measured and empirical; it’s one that billionaires and corporations can happily endorse. But his stance is also a simple matter of personality: Chetty is no agitator. He told me, “I like to find solutions that please everyone in the room, and this definitely has that feel.”

In Charlotte, even the circumscribed version of social change that Chetty is attempting looks daunting. Last summer, before the Opportunity Insights team came to town, I drove around to the back of West Charlotte High School, to a hamlet of pale-yellow temporary-classroom buildings, each set on concrete blocks. One building has been given over to Eliminate the Digital Divide, known as E2D, a nonprofit that takes donations of old laptops, then refurbishes and distributes them for $60 apiece to students who have no computer of their own. According to E2D, half of the county’s public-school students have been unable to complete a homework assignment because they don’t have access to a computer or the internet.

Inside the E2D building is a bright room ringed by a series of workstations where West Charlotte student-employees inspect laptops, set up hard drives, and test the final products. Whiteboards, photos, and posters with inspirational phrases like college bound! cover the walls. By the door, a pair of yellow couches serve as a waiting area. When the boys get their computers, they work hard to suppress a smile, whereas the girls are prone to let loose. Sometimes they jump up and down, and sometimes they cry.

I met Kalijah Jones, a young black woman in a pale-pink sleeveless blouse and matching skirt. She had started working at E2D during her senior year, in 2017. Not long into our conversation, she said, “I love my life!”—this despite the fact that she was living in a homeless shelter at the time.

For Jones, the biggest benefit brought by E2D was not the computer or the job, but the social capital the program provided. Last year, she said, E2D’s West Charlotte lab was recognized with a local technology award, and the founder invited Jones and some of her co-workers to join him for the awards ceremony at the Knight Theater, where the Charlotte Ballet performs. One of the other honorees was Road to Hire, a program that pays high-school graduates as it trains them for jobs in sales and tech. The head of Road to Hire was at the ceremony, and he gave Jones a business card, which led to a paid spot in the program’s training program.

But in the crimson sectors of Chetty’s atlas, the problem is both the absence of opportunity and the presence of its opposite: swift currents that can drag a person down. There are, in these places, a few narrow paths to success, and 99 ways to falter. Jones made it through high school despite living in a shelter, and was accepted to Western Carolina University with financial aid. But she decided not to go, in part because she couldn’t imagine leaving her struggling mother and sister behind to live on a campus three hours away. Last winter, the three of them left Charlotte, and the prospects that were beginning to open up for Jones there, and moved to New Jersey, where she grew up. When I last spoke with her, she’d found work at an Amazon warehouse.

One Friday evening, I was in Chetty’s Stanford office when a ballerina arrived. Sanvi, Chetty’s 3-year-old daughter, wore a pink tutu with matching hair ribbons and tights. She declined—vigorously—the white sweater offered to ward off the evening chill. Chetty and I had spent hours discussing his research, but when the nanny dropped Sanvi off, it marked the end of the day. Chetty gathered his things and whisked her up in his arms. “Hold me properly, Appa,” Sanvi admonished. Outside, we got into Chetty’s aging silver Acura and headed to an Indonesian restaurant for takeout. Sanvi bubbled with enthusiasm. “I want to be a fairy princess,” she announced from the back seat. “Can I be a fairy princess?” Chetty glanced in the rearview mirror and assured Sanvi that when she grows up, she can be whatever she wants.

After stopping for the food, we pulled up to a light-brown ranch house, with beautiful plantings out front. Inside, the house was clearly Sanvi’s. Taking a seat in the open kitchen, I was surrounded by a tapestry of exuberant finger paintings taped to the walls, interspersed with pages neatly torn from coloring books (penguins, parrots, bunnies, each splashed with color). A pair of persimmon trees were fruiting out back.

Chetty told me that his interest in poverty dates back to the horrifying want he observed on the streets of New Delhi. But only when he built the first version of his atlas did he see what he should do about it. “I realized,” he said, “we could have the biggest impact on poverty by focusing on children.”

Chetty thinks about revolution like an economist does: as a compounding accumulation of marginal changes. Bump the interest rate on your savings account by one notch, and 30 years later, your balance is much improved. Move a family to a better zip code, or foster the right conditions in that family’s current neighborhood, and their children will do better; do that a thousand times, or ten thousand, and the American dream can be more possible, for more people, than it is today.

In the 1930s, the poet Langston Hughes published what remains one of the most honest descriptions of that dream:

A dream so strong, so brave, so true
That even yet its mighty daring sings
In every brick and stone, in every furrow turned
That’s made America the land it has become

The poem, though, is laced with a counterpoint of protest: “America was never America to me”—not to the “man who never got ahead”; “the poorest worker bartered through the years”; or “the Negro, servant to you all.” Still, for all its outrage, the poem ends with a paradoxical yearning: “O, let America be America again,” Hughes wrote. “The land that never has been yet.”

Hearing stories of the American dream as a boy in New Delhi, Chetty adopted the faith. When he became a scientist, he discerned the truth. What remains is contradiction: We must believe in the dream and we must accept that it is false—then, perhaps, we will be capable of building a land where it will yet be true.


This article appears in the August 2019 print edition with the headline “Raj Chetty’s American Dream.”

* This article originally stated that Minneapolis was the home of the Mayo Clinic.

 Image of W8jH8I2k6bg

A new CDC report found that Kansas counties who complied with a mask mandate saw a decrease in cases compared to counties that didn't

A new CDC report found that Kansas counties who complied with a mask mandate saw a decrease in cases compared to counties that didn't

Trump, Dr. Fauci, Birx briefing masks mask
President Donald Trump opted against wearing a face mask at a press conference in May, while flanked advisers Drs. Deborah Bird and Anthony Fauci, who wore face masks.

  • A Friday report from the Centers for Disease Control found that counties in Kansas that adopted a mask mandate saw a decrease in cases of the disease, while counties that opted out saw an increase by 100%.
  • While experts have long agreed that masks are a key part of limiting the spread of COVID-19, their usage has been the subject of months-long political debate.
  • According to the CDC, the findings back up similar declines seen in 15 states and in Washington DC, which also mandated masks.
  • Visit Business Insider’s homepage for more stories.

A new report from the Centers for Disease Control and Prevention released Friday found that counties in Kansas that adopted a mask mandate saw a decrease in COVID-19 transmission compared to counties that did not, which saw an increase in the disease caused by the novel coronavirus.

Kansas Gov. Laura Kelly, a Democrat, on July 3 issued a statewide mask mandate, but counties were able to individually opt-out from her order. Around 90 counties opted out of her according to a July 8 report from the Wichita Eagle.

According to the CDC report, following the issuing of the opt-out mandate, COVID-19 incidence decreased in 24 counties with mask mandates but increased in 81 counties that opted out of the order. Researchers with the CDC and the Kansas Department of Health found COVID-19 incidence decreased by 6% in counties with a mandate compared to an increase of 100% in counties where masks were not mandated.

The findings back up similar declines seen in 15 states and in Washington DC, which mandated masks, compared to states that did not have mask mandates, the CDC noted.

Kelly on Wednesday announced a new mask mandate, effective next week, which requires masks in public spaces, health care facilities, public transportation lines, and outdoor spaces where social distancing is not possible, The Hill reported. Kelly is also planning a public information campaign to encourage mask usage in the state, she said.

According to data analyzed by Johns Hopkins University, there have been 136,861 confirmed cases of the disease throughout the state of Kansas, which have resulted in at least 1,306 deaths. Over the past week, more than 35% of tests administered have come back positive, which is more than three times higher than the 10% rate nationally.

The CDC report echos months-long pleas from medical experts and the science community, which have urged the widespread adoption of face masks to stem the spread of COVID-19.  President Donald Trump and many of his Republican allies have opposed mask mandates, arguing their use should be left up to individuals, leading to frequent clashes between Democrats and Republicans and dicey public confrontations between US citizens. 

President-elect Joe Biden has said he would consider implementing a nationwide mask mandate as part of his COVID-19 mitigation strategy, and Dr. Anthony Fauci, the longtime director of the National Institute of Allergy and Infectious Diseases, in October said he endorsed a mask mandate.

“There’s going to be a difficulty enforcing it, but if everyone agrees that this is something that’s important and they mandate it and everybody pulls together and says, you know, we’re going to mandate it but let’s just do it, I think that would be a great idea to have everybody do it uniformly,” he said during an appearance on CNN.

Read the original article on Business Insider
 Image of silicon alley insider?i=JDMrw4kYDio:6YETL9t1TSM:V sGLiPBpWU  Image of silicon alley insider?d=qj6IDK7rITs  Image of silicon alley insider?d=bcOpcFrp8Mo  Image of silicon alley insider?i=JDMrw4kYDio:6YETL9t1TSM:gIN9vFwOqvQ  Image of silicon alley insider?d=cGdyc7Q 1BI  Image of silicon alley insider?d=QXVau8BzmBE  Image of silicon alley insider?d=yIl2AUoC8zA  Image of silicon alley insider?d=7Q72WNTAKBA

 Image of JDMrw4kYDio

PubSub using channels in Go

The idiomatic way of writing concurrent code in Go is as a collection of
goroutines communicating over channels. In my experience, the Publish-subscibe
pattern

(PubSub) comes up often as a way to structure code. The pattern presented here
has topic-based subscriptions, but publish-subscribe can appear in other
disguises as well. In its most simple form, it could be a goroutine that
produces data and wants to notify a group of other goroutines of that data, with
each downstream goroutine having access to the data separately (rather than on a
first-come-first-serve basis as in a work queue). If "PubSub" doesn’t ring a
bell, you might be familiar with its alter egos "message broker" and "event
bus".

In this post I’ll present a brief overview of some design decisions that arise
when implementing PubSub for a Go application. To be clear: this is PubSub for
in-process communication between multiple goroutines over channels. It does
not attempt to solve a distributed PubSub problem, which requires sophisticated
mechanisms for fault-tolerance. Within a single Go process we assume goroutines
don’t just fail and all data sent into channels can be reliably read from the
other end.

Let’s start with a simple and incomplete implementation.
We’ll have the type Pubsub with some methods, which clients can use to
subscribe to topics and publish on topics:

type Pubsub struct {
  mu   sync.RWMutex
  subs map[string][]chan string
}

The key data structure here is subs, which maps topic names into a slice
of channels. Each channel represents a subscription to the topic. I’ll talk more
about the lock later.

The struct fields aren’t exported. Clients interact with Pubsub solely using
its methods. Let’s start with a constructor:

func NewPubsub() *Pubsub {
  ps := &Pubsub{}
  ps.subs = make(map[string][]chan string)
  return ps
}

Now, a Subscribe method through which clients can subscribe to new topics.
To subscribe, the client will provide:

  1. The topic it’s interested in
  2. A channel on which Pubsub will send it new messages for this topic from
    now on
func (ps *Pubsub) Subscribe(topic string, ch chan string) {
  ps.mu.Lock()
  defer ps.mu.Unlock()

  ps.subs[topic] = append(ps.subs[topic], ch)
}

The code is very concise thanks to Go’s default value semantics. If ps.subs
has no topic key, it returns a default value for its value type, or an
empty slice of chan string. This can be appended to and the result is what
we expect regardless of the initial contents of ps.subs.

Publishing on the Pubsub is done with the Publish method, which takes
a topic and the message:

func (ps *Pubsub) Publish(topic string, msg string) {
  ps.mu.RLock()
  defer ps.mu.RUnlock()

  for _, ch := range ps.subs[topic] {
    ch <- msg
  }
}

Once again the default value semantics in Go are useful. If there are no
subscribers to topic, ps.subs[topic] is an empty slice so the loop
doesn’t run.

This is the place to mention the lock. One of Go’s most famous philosophies is
"share memory by communicating", but Go is also a pragmatic language. When we
have a shared data structure accessed by multiple goroutines, it’s OK to use
a lock to protect access to it if this results in the clearest
code. In our case, each Pubsub method starts with a lock + defer unlock
sequence, so the code is really simple. We do have to be very careful about
blocking inside Pubsub methods though; more on this shortly.

Note that we don’t have an Unsubscribe method. This is left as an exercise
to the reader.

Closing the subscription channels

The code shown so far has a serious issue. The channels on which messages are
sent aren’t closed; this is not great, because there’s no way for subscribers to
be notified that no more messages are going to be sent. In Go, closing channels
is important once we’re done sending on them, because closing a channel is a
signal that some job is done and resources can be cleaned up.

Here is a version of the code with a Close method:

type Pubsub struct {
  mu     sync.RWMutex
  subs   map[string][]chan string
  closed bool
}

We’re adding a closed flag to the Pubsub struct. It’s initialized to
false in the constructor. Publish is modified to:

func (ps *Pubsub) Publish(topic string, msg string) {
  ps.mu.RLock()
  defer ps.mu.RUnlock()

  if ps.closed {
    return
  }

  for _, ch := range ps.subs[topic] {
    ch <- msg
  }
}

And we add a new Close method:

func (ps *Pubsub) Close() {
  ps.mu.Lock()
  defer ps.mu.Unlock()

  if !ps.closed {
    ps.closed = true
    for _, subs := range ps.subs {
      for _, ch := range subs {
        close(ch)
      }
    }
  }
}

When a Pubsub is done, Close ought to be called to signal on all the
subscription channels that no more data will be sent.

Note that these channels weren’t created by Pubsub; they are provided
in calls to Subscribe. Is Pubsub.Close the right place to close them?
This is a good question. In general, it is idiomatic for the sending side to
close a channel, because this is its way to signal to the receiving side that no
more data is going to be sent. Moreover, since sending on a closed channel
panics, it’s dangerous to close channels on the receiving side because then the
sending side doesn’t know that the channel it is sending into may be closed.

This brings us to the more important topic of where should these channels be
created in the first place. Is creating them outside Pubsub and passing
them in the right design, or should Pubsub create them?

Buffering in pubsub channels

The critical issue here is blocking. Recall the sending loop in Publish:

for _, ch := range ps.subs[topic] {
  ch <- msg
}

If ch is unbuffered, then ch <- msg will block until the message is
consumed by a receiver. This prevents Pubsub from notifying other
subscribers on the same channel. Is this the desired behavior? Not likely. Unless
you can guarantee that receivers consume messages from subscriptions very
quickly, it may be a good idea to buffer the channels. A buffer of size 1 would
make it much more robust, wherein the publishing loop could finish notifying
all topic subscribers quickly (unless a receiver is badly backed up and hasn’t
even consumed the previous message yet).

In our current design, channels are created outside Pubsub, so their
buffering is determined by clients. This has both positives and negatives:

  • Positive: Pubsub doesn’t know how clients consume the channels, so it
    doesn’t have to guess what buffer size is appropriate when creating a channel.
    The client passes it a channel that’s already created with the right buffer
    size.
  • Negative: the correctness of Pubsub becomes dependent on its clients. A
    slow client that passed in an unbuffered channel can block all other clients
    from consuming their messages.

Creating the subscription channels in Pubsub

An alternative design is to create subscription channels in Pubsub. Only the
Subscribe method would have to change. Here it is:

func (ps *Pubsub) Subscribe(topic string) <-chan string {
  ps.mu.Lock()
  defer ps.mu.Unlock()

  ch := make(chan string, 1)
  ps.subs[topic] = append(ps.subs[topic], ch)
  return ch
}

Note that the buffer size is hardcoded to 1. While this is a good default, we
may want to let the client configure the buffer size with an argument. This can
either be done in the constructor for all subscriptions, or in Subscribe
with a different buffer size per subscription.

This version of Pubsub has the nice property that it both creates and closes
the channels, so the separation of responsibilities is cleaner. Subscribers just
get a channel and listen on it until it’s closed.

One slight inconvenience with this approach is that clients may want to
subscribe the same channel to multiple topics. In the previous version of
Pubsub they could do so by passing in the same channel to multiple
Subscribe calls; in this version they cannot.

However, subscribing the same channel to multiple topics is problematic in other
ways. For example, Pubsub may attempt to close the same channel multiple
times when done – this panics. We’d have to add special provisions to Close
to avoid that (such as keep a set of all channels already closed).

In general, I would recommend avoiding this and sticking to a cleaner
one-channel-per-subscription approach. In case the client wants to use the same
range loop to receive from multiple topics, it’s easy to use some kind of
channel fan-in solution instead.

Doing each send in a goroutine

When we discussed the danger of ch <- msg blocking all clients, you may
have wondered why we don’t just perform each send in its own goroutine. Here is
a version of Publish that does this:

func (ps *Pubsub) Publish(topic string, msg string) {
  ps.mu.RLock()
  defer ps.mu.RUnlock()

  if ps.closed {
    return
  }

  for _, ch := range ps.subs[topic] {
    go func(ch chan string) {
      ch <- msg
    }(ch)
  }
}

Now it doesn’t matter how much buffering each channel has; the send will not
block any other sends because it runs in its own goroutine.

There may be performance implications, of course. Even though starting and
tearing down goroutines is very quick, do you really want a new one to run for
every message
? The answer depends on your particular application.
When in doubt, benchmark it.

But performance implications are not the most serious potential issue with this
code. It decouples the places where data is sent on subscription channels and
where these channels are closed, which always leaves me a bit uneasy.

Consider a slow client that causes its subscription channel to block for a long
while. Meanwhile, Pubsub may be closed and attempt to close the
channel. But closing channels that have writes pending on them is bad – it’s a
race condition, which is one of the worst kinds of bug to have. In the original
code this can’t happen because Publish holds a lock that prevents Close
from running at all.

Conclusion

The goal of this post was to demonstrate some design choices for a simple yet
functional piece of code. Channels in Go are powerful, but they’re not magic.
Difficult questions of ownership and ordering still arise, and it’s instructive
to think through a single problem from multiple angles.

Of the approaches presented here, I personally prefer the one where
Subscribe creates new channels and returns them. This approach is the most
conceptually simple, IMHO, because the ownership of these channels is the most
centralized. Pubsub creates them, sends on them, and closes them. For a
client, the life cycle of a subscription channel is very clear: a new channel is
created by Subscribe and can be read from until it’s closed. Calling
Pubsub.Close will close all outstanding subscription channel and is useful
for cleanup. If we need configurable buffering, this is easy to add.