Skip to content

Instantly share code, notes, and snippets.

View shibd's full-sized avatar
🏠
Working from home

Baodi Shi shibd

🏠
Working from home
View GitHub Profile
@shibd
shibd / cyclic_references.cc
Created September 2, 2022 08:29 — forked from BewareMyPower/cyclic_references.cc
c++ shared_ptr cyclic references by capturing shared_from_this()
#include <atomic>
#include <functional>
#include <iostream>
#include <memory>
using namespace std;
static std::atomic_int idGenerator{0};
struct Object {
int id;
@shibd
shibd / pulsar-large-consumer.txt
Last active July 24, 2024 13:36
If a subscription has many consumers and each consumer individually acknowledges messages from other consumers, this scenario is very CPU resource-intensive.
public static void main(String[] args) throws PulsarClientException {
final String subName = "test";
final String topicName = "persistent://public/default/testAckMessageWithMultipleConsumers-" + UUID.randomUUID();
PulsarClient pulsarClient = PulsarClient.builder().serviceUrl("pulsar://localhost:6650").build();
@Cleanup
Producer<byte[]> producer = pulsarClient