Skip to content

Instantly share code, notes, and snippets.

View Biacode's full-sized avatar
:octocat:
Coding

Arthur Biacode

:octocat:
Coding
View GitHub Profile
@anair-it
anair-it / Spring Chained Tx Management.md
Last active October 27, 2020 10:10
Best efforts 1Phase Commit using Spring chained transaction managemer and Apache Camel

Best efforts 1 Phase commit

This is a non-XA pattern that involves a synchronized single-phase commit of a number of resources. Because the 2PC is not used, it can never be as safe as an XA transaction, but is often good enough if the participants are aware of the compromises. The basic idea is to delay the commit of all resources as late as possible in a transaction so that the only thing that can go wrong is an infrastructure failure (not a business-processing error). Systems that rely on Best Efforts 1PC reason that infrastructure failures are rare enough that they can afford to take the risk in return for higher throughput. If business-processing services are also designed to be idempotent, then little can go wrong in practice.

Scenarios

Consider a jms based service, where there is an inbound Queue manager (QM1), an outbound queue manager (QM2) and a database (DB). Here are the scenarios that I would like to cover using Best efforts 1 PC commit process:

Happy path

  1. Start MQ transaction on QM1 2
@Atlas7
Atlas7 / remove_postgres_on_mac_os.md
Last active March 23, 2023 13:02
Note - How completely uninstall PostgreSQL 9.X on Mac OSX

This blog post has helped me clean up my postgres development environment on Mac. So making a copy!

How completely uninstall PostgreSQL 9.X on Mac OSX

This article is referenced from stackoverflow:

If installed PostgreSQL with homebrew , enter brew uninstall postgresql

If you used the EnterpriseDB installer , follow the following step.
@thanhson1085
thanhson1085 / apiserver.service
Last active March 20, 2017 18:51
Run Single-node Kubernetes on CoreOS
[Unit]
Description=Kubernetes API Server
After=etcd2.service
After=docker.service
Wants=etcd2.service
Wants=docker.service
[Service]
ExecStart=/opt/bin/kube-apiserver \
--insecure-bind-address=0.0.0.0 \
@jboner
jboner / latency.txt
Last active May 11, 2024 04:16
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@jessex
jessex / counter.sh
Created June 14, 2011 17:55
Count all lines of code for java source files in current directory
find . -name '*.java' | xargs wc -l