Holy on Dev
Clojure vs Java: Troubleshooting an application in production
I have just gone through the painful experience of troubleshooting a remote Java webapp in a production-like environment and longed for Clojure’s explore-and-edit-running-app REPL. I want to demonstrate and contrast the tools the two languages offer for this case.
Clojure vs Java: The benefit of Few Data Structures, Many Functions over Many Unique Classes
In Clojure we use again and again the same data structures and have many functions operating on them. Java programmers, on the other hand, create a unique class for every grouping of data, with its own “API” (getters, setters, return types, …) for accessing and manipulating the data. Having been forced to translate between two such “class APIs” I want to share my experience and thus demonstrate in practical terms the truth in the maxim
It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures.
- Alan Perils in Epigrams on Programming (1982)
Solution design in Java/OOP vs. Clojure/FP - I/O anywhere or at the boundaries? - experience
As a Clojure developer thrown into an “enterprise” Java/Spring/Groovy application, I have a unique opportunity to experience and think about the differences between functional (FP) and object-oriented programming (OOP) and approach to design. Today I want to compare how the solution would differ for a small subsystem responsible for checking for and progressing the process of fixing data discrepancies. The main question we will explore will be where do we deal with external effects, i.e. I/O.
It will only take one hour... (On why programmers suck at estimating and the perils of software development)
Programming is difficult and there are always unforeseen complications. It is crucial to have the right mindset and approach (and focus). Good tools really matter a lot. Invest into “developer-friendliness,” making issues easier to understand and faster to resolve and making (manual) testing easier. Beware accidental complexity and invest into making your systems “simple”.
How to use Clojure 1.10 pREPL to connect to a remote server (WIP)
Clojure 1.10 includes a new, program-friendly REPL or prepl (pronounced as “preppy,” not p-repl). However there is still very little documentation about it, though it is reportedly in making (it is alpha, after all). Here I want to demonstrate how to start it and how to connect to it in a primitive way (I hope to improve the user experience of the client eventually).
AWS RDS: How to find out login credentials to the database
To log in to your AWS RDS database (Oracle in my case) you need login credentials, but what are these for a newly created DB? The password is the master user password you entered during DB creation and which you can change via the Console.
To find out the master user name:
aws rds describe-db-instances --output table --query 'DBInstances[*].DBInstanceIdentifier'
aws rds describe-db-instances --db-instance-identifier <an identifier from the previous table> \ --query 'DBInstances[*].MasterUsername'
Migrating from Wordpress.com to a static site generated by GatsbyJS
If you are interested in the details of the migration, check out the blog code at GitHub, especially blog2md-master/index.js and gatsby-node.js. The core of the process is using
blog2mdto turn Wordpress export XML into .json files and then loading those into Gatsby and suing custom code in
gatsby-node.jsto create an “adapter” node type
ContentPagefor both new Markdown-based posts and the old ones from the .json. In practice it is somewhat more complicated that it sounds - just as always.
Java: Simulating various connection problems with Toxiproxy
How I got fired and learned the importance of communication and play time
When I came to the office one late autumn morning in 2005, I have been shocked to find out that - without any warning signs whatsoever - I hd been fired. That day I have learned the importance of communication. Their criticism was justified but the thing is, nobody bothered to tell me anything during my 11 months in the company. I received exactly 0 feedback about my behaviour or work. The company ended up at court with its client - which both explains why they were stressed and was also caused by bad communication. So communication - even, or especially under stress - is really important. It must be open, transparent, and broad.
The funny thing is that I still do the things they fired me for.
Clojure - comparison of gnuplot, Incanter, oz/vega-lite for plotting usage data
What is the best way to plot memory and CPU usage data (mainly) in Clojure? I will compare gnuplot, Incanter with JFreeChart, and vega-lite (via Oz). (Spoiler: I like Oz/vega-lite most but still use Incanter to prepare the data.)
The data looks like this:
;; sec.ns | memory | CPU % 1541052937.882172509 59m 0.0 1541052981.122419892 78m 58.0 1541052981.625876498 199m 85.9 1541053011.489811184 1.2g 101.8
The data has been produced by monitor-usage.sh.
Gnuplot is the simplest, with a lot available out of the box. But it is also somewhat archaic and little flexible.
How good monitoring saved our ass ... again
You know how it goes - suddenly people complain your app does not work, your are getting plenty of timeouts or other errors in your error tracking tool, you find the backend app that is misbehaving and finally "fix" the problem by restarting it. Phew!
Beware the performance cost of async_hooks (Node 8)
I was excited about async_hooks having finally landed in Node.js 8, as it would enable me to share important troubleshooting information with all code involved in handling a particular request. However it turned out to have terrible impact of our CPU usage (YMMV):
Monitoring process memory/CPU usage with top and plotting it with gnuplot
If you want to monitor the memory and CPU usage of a particular Linux process for a few minutes, perhaps during a performance test, you can capture the data with
topand plot them with
gnuplot. Here is how:
Troubleshooting javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
Re-published from the Telia Tech Blog.
Pains with Terraform (perhaps use Sceptre next time?)
Cross-posted from Telia's Tech Blog
We use Amazon Web Services (AWS) heavily and are in the process of migrating towards infrastructure-as-code, i.e. creating a textual description of the desired infrastructure in a Domain-Specific Language and letting the tool create and update the infrastructure.
We are lucky enough to have some of the leading Terraform experts in our organisation so they lay out the path and we follow it. We are at an initial stage and everything is thus "work in progress" and far from perfect, therefore it is important to judge leniently. Yet I think I have gain enough experience trying to apply Terraform both now and in the past to speak about some of the (current?) limitations and disadvantages and to consider alternatives.
- Next (25)