Is Java Still the Best Choice Now That Go Is Available?

Introduction

Quick Start

curl https://gosling.alibaba-inc.com/sh/enable-wisp2.sh | sh
ajdk 8.7.12_fp2 rpm
sudo yum install ajdk -b current #
java -XX:+UseWisp2 .... #

Overhead of Multithreading

Misunderstanding 1: Context Switching is Caused by Accessing the Kernel

pipe(a);
while (1) {
write(a[1], a, 1);
read(a[0], a, 1);
n += 2;
}

Misunderstanding 2: The Overhead of Context Switching is High

Overhead

Relationship Between Asynchronization and Coroutine

private void writeQuery(Channel ch) {
ch.write(Unpooled.wrappedBuffer("query".getBytes())).sync();
logger.info("write finish");
}
private void writeQuery(Channel ch) {
ch.write(Unpooled.wrappedBuffer("query".getBytes()))
.addListener(f -> {
logger.info("write finish");
});
}
suspend fun Channel.aWrite(msg: Any): Int =
suspendCoroutine { cont ->
write(msg).addListener { cont.resume(0) }
}
suspend fun writeQuery(ch: Channel) {
ch.aWrite(Unpooled.wrappedBuffer("query".toByteArray()))
logger.info("write finish")
}

Performance Comparison: Manual Asynchronous Programming vs WISP Programming

Write a New Application Based on Existing Components

Develop a New Application from Scratch

Adapted Workload

Project Loom

Frequently Asked Questions (FAQs)

Why is the Overhead Small in Case of Scheduled Coroutines?

Why Doesn’t WISP 2 Use ForkJoinPool to Schedule Coroutines?

What Do You Think of Reactive Programming?

What are the Main Constraints at the Moment?

Original Source:

--

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

An Introduction to Pandas in Python

Azure DevOps multi-stage deployments

End of this Amazing Journey : GSoC-21

Now Open: SolDate Private Sale Whitelisting

Deploying Drupal 8 with Ansible playbook

Creating waves of enemies

JAVA Classes/Inheritance/Interfaces Quiz

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

GitHub Packages: Publish and Consume Artifacts of a Spring Gradle Project

Get Set Go(lang).. as a Java Pro

Effectively Bridging the DevOps — R&D Gap without Sacrificing Reliability

How to Get Started with GoLang as a Java Developer