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

Hosting AngularDart SPA on GitLab with single repository

Using TTY:Prompt & TTY:Box in a CLI Application.

Snake Game Dev Diary #2

#iOS development 100 days : Day 1

Run Fn Project on your Raspberry Pi

Discover Dreem, the ‘metaverse pipe,’ in 30 seconds

How SharePoint views work

Single-node Kubernetes on Home Lab using MicroK8s, Metallb, and Traefik

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

SQL mock tests with the Goyave framework

Types in Go

Communicating Between Polyglot Services Using gRPC

Basic concepts of garbage collector