Kubernetes Patterns-Distributed Primitives(k8s模式-分布式原语)

本文对比了Kubernetes提供的分布式系统构建抽象与Java的面向对象编程概念。Kubernetes为跨多节点和进程构建分布式系统引入了新的运行时和原始概念,补充了Java本地进程内的构建块。通过使用Kubernetes的原始概念,如CronJob,可以完全替代Java中的某些行为,如ExecutorService,展示了分布式应用构建的新维度。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

To explain what we mean by new abstractions and primitives, here we compare them with the
well-known object-oriented programming (OOP), and Java specifically. In the OOP universe, we
have concepts such as class, object, package, inheritance, encapsulation, and polymorphism. Then
the Java runtime provides specific features and guarantees on how it manages the lifecycle of our
objects and the application as a whole.
The Java language and the Java Virtual Machine (JVM) provide local, in-process building blocks for
creating applications. Kubernetes adds an entirely new dimension to this well-known mindset by
offering a new set of distributed primitives and runtime for building distributed systems that
spread across multiple nodes and processes. With Kubernetes at hand, we don’t rely only on the
local primitives to implement the whole application behavior.
We still need to use the object-oriented building blocks to create the components of the distributed
application, but we can also use Kubernetes primitives for some of the application
behaviors. Table 1-1 shows how various development concepts are realized differently with local
and distributed primitives.

 

The in-process primitives and the distributed primitives have commonalities, but they are not
directly comparable and replaceable. They operate at different abstraction levels and have different
preconditions and guarantees. Some primitives are supposed to be used together. For example, we
still have to use classes to create objects and put them into container images. However, some other
primitives such as CronJob in Kubernetes can replace the ExecutorService behavior in Java
completely.

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Dreamer who

你的鼓励将是我创作的最大动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值