ARTS Week 2

博客涵盖算法、技术介绍、数据库技巧和框架实践。介绍了Kafka的基本组件如Broker、Producer、Consumer,分析其流行原因,探讨count(1)与count(*)谁更高效,还分享了Hibernate 5和Spring Boot 2的性能优化实践。

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

Algorithm

Add Two Numbers

import com.tntcpu.leetcode.utils.ListNode;

public class AddTwoNumbers_2_Best {

    public static void main(String[] args) {
        ListNode l1 = new ListNode(0);
        l1.next = new ListNode(1);
        ListNode l2 = new ListNode(0);
        l2.next = new ListNode(1);
        l2.next.next = new ListNode(2);

        ListNode l3 = addTwoNumbers(l1, l2);
        int val = l3.val;
        int val1 = l3.next.val;
        int val2 = l3.next.next.val;
        System.out.println(val);
        System.out.println(val1);
        System.out.println(val2);
    }

    private static ListNode addTwoNumbers(ListNode l1, ListNode l2) {
        ListNode dummyHead = new ListNode(0);
        ListNode p = l1, q = l2, curr = dummyHead;
        int carry = 0;
        while (p != null || q != null) {
            int x = (p != null) ? p.val : 0;
            int y = (q != null) ? q.val : 0;
            int sum = carry + x + y;
            carry = sum / 10;
            curr.next = new ListNode(sum % 10);
            curr = curr.next;
            if (p != null) p = p.next;
            if (q != null) q = q.next;
        }
        if (carry > 0) {
            curr.next = new ListNode(carry);
        }
        return dummyHead.next;
    }
}

Review

An introduction to Kafka

Summary:

  1. A few basic components in Kafka are:
    1.1 Broker: A Kafka broker is where the data sent to Kafka is stored.
    1.2 Producer: A producer is an entity that sends data to the broker.
    1.3 Consumer: A consumer is an entity that requests data from the broker.

  2. Kafka stores data in topics. Producers send data to specific Kafka topics, and consumers read data also from specific topics.

  3. There are a few reasons for the continued popularity and adoption of Kafka in the industry:
    3.1 Scalability: Two important features of Kafka contribute to its scalability.
    3.2 Fault tolerance and reliability: Kafka is designed in a way that a broker failure is detectable by other brokers in the cluster.
    3.3 Throughput: Brokers can store and retrieve data efficiently and at a super-fast speed.

Tip

count(1)与count(*)谁更高效

Share

Best Performance Practices for Hibernate 5 and Spring Boot 2 (Part 2)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值