Published May-13-2020
import java.io.IOException; | |
import java.net.URL; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.util.ArrayList; | |
import java.util.BitSet; | |
import java.util.List; | |
import java.util.concurrent.ThreadLocalRandom; | |
import java.util.stream.Stream; |
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.
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 |
When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.
This is enabled by adding the
ForwardAgent yes
option to any of your Host
entries in ~/.ssh/config
(or alternatively with the -A
option). Don't set this option in a wildcard Host *
section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.
#!/usr/bin/env bash | |
## | |
# This configures an S3 bucket ObjectCreated notification for the given Lambda | |
# function so that when a file is uploaded the Lambda function is invoked. This | |
# is useful when the bucket is not defined in the same CloudFormation template | |
# as the function. CloudFormation cannot setup the notification in this case. | |
# | |
# Note that the AWS CLI is used and will require valid AWS credentials for the | |
# account containing the resources. The 'jq' JSON processor is also required |
--- | |
execution: | |
- write-xml-jtl: full | |
scenario: shire | |
executor: jmeter | |
concurrency: 100 | |
ramp-up: 5m | |
hold-for: 15m | |
throughput: 60 |
execution: | |
- concurrency: 100 | |
ramp-up: 1m | |
hold-for: 5m | |
scenario: quick-test | |
scenarios: | |
quick-test: | |
requests: | |
- http://blazedemo.com |
Let's suppose we have 2 datacenters | |
dc1 | |
dc2 | |
Available Reaper configuration options: | |
1) datacenterAvailability: ALL | |
create keyspace reaper_db with replication = {'class' : 'NetworkTopologyStrategy', 'dc1': 3, 'dc2': 3}; | |
1 Reaper instance handling the entire cluster with 2 datacenters |