LeetCode Problem 3: Longest Substring Without Repeating Characters
ProblemGiven a string, find the length of the longest substring without repeating characters. Examples: Given “abcabcbb”, the answer is “abc”, which the length is 3. Given “bbbbb”, the answer is “b”, with the length of 1. Given “pwwkew”, the answer is “wke”, with the length of 3. Note that the answer must be a substring, “pwke” is a subsequence and not a substring. In other words, given a string, output the length of the longest substring without repeating characters. ApproachThe problem can ...
Investigating a Kafka Disk Usage Spike: Data Compression, Batch Sending, and More
The ProblemOur company needs to receive a large amount of external data from various sources, including IBM MQ, ActiveMQ, Redis pub/sub, and more. To funnel all this data into our internal AMQ/Kafka, we previously ran a large number of separate processes, which were quite complex to manage. Recently, we consolidated these processes using Apache Camel. A few hours after deployment, Kafka disk space alerts started firing. We initially determined that this was caused by the new deploym...
The Magic of 128 in Java: Understanding Integer Caching
Java’s Integer caching mechanism is a frequently asked interview topic and a common source of pitfalls in daily development. To understand it, let’s start with a counterintuitive experiment. The Curious Case of 1281234567Integer a = 148;Integer b = 148;System.out.println(a == b); // false — as expected, two different objectsInteger c = 48;Integer d = 48;System.out.println(c == d); // true — wait, why? The same == comparison returns false for 148 but true for 48. The reason lies in Intege...
Storm/JStorm Ecosystem and Peripheral Tools: Connecting Storm to ActiveMQ, Kafka, HDFS and More
Storm has a very rich surrounding ecosystem. There are ready-made toolkits available for interacting with Kafka, ActiveMQ, HDFS, HBase, and others. Most of these tools, including those introduced today, can also be used normally in JStorm. storm-jmsImplements interaction with JMS implementations such as ActiveMQ. Here we mainly introduce JmsSpout. Since sending queue data in Storm is no different from regular Java programs, wrapping it in a dedicated bolt seems unnecessary. https://github.com...
JStorm UI Introduction
UI OverviewCompared to Storm, JStorm’s UI provides more detailed monitoring items. The UI itself is a WAR package running in Tomcat, making secondary development relatively easy. Cluster PageCluster Summary, Cluster Stats, Topology SummaryOverall cluster information. The conf section contains the configuration of the nimbus node. Topology SummaryA list of all currently running topologies along with summary information. The conf section corresponds to topology-specific configuration items. Sup...
Five Minutes to Learn Storm Coding: JStorm/Storm Coding Principles and Differences from Regular Java Programs
Storm (and Alibaba’s open-source fork JStorm) is a distributed real-time computation framework. Its programming model has some key differences from traditional Java programs. If you don’t understand these differences, it’s easy to write code that runs fine locally but produces all sorts of bizarre bugs when deployed to a cluster. This article doesn’t dive deep into Storm’s internals. Instead, it focuses on the few critical differences that developers most need to know — helping you get up to ...
ActiveMQ Web Console Security Configuration
Security Risks of Web ConsoleActiveMQ’s web console is built on Jetty, and its permission management is also based on Jetty. Based on requirements, different permissions can be assigned to different users. Jetty’s permission management is fairly flexible, though it can be a bit cumbersome to configure. You can specify whether a particular role (role) has access to a specific page. JAAS Authentication ConfigurationBelow is a brief introduction to the configuration method. You only need to modi...
Understanding Key Properties in Storm UI
Storm UI OverviewStorm UI is very helpful for troubleshooting issues encountered during Storm usage, but some properties have unclear meanings. Although they are all simple concepts, not knowing them can be quite frustrating. One thing to note: when you hover over the title bar in the UI, you can see the specific details of that property. Several highly-ranked Google articles are essentially just organizing this information. Most properties are straightforward — you know what they mean just b...
ActiveMQ 5.6 Connection Pool Memory Leak Issue
Problem SymptomsRecently, while using ActiveMQ’s connection pool, I discovered a very serious memory leak issue. Investigation ProcessThrough jmap monitoring, it can be seen that java.util.concurrent.locks.ReentrantLock and org.apache.activemq.pool.PooledConnection occupy a very large amount of memory, and the growth rate is also very fast. Root Cause AnalysisAfter searching online, I found exactly the corresponding ActiveMQ bug report: https://issues.apache.org/jira/browse/AMQ-3997 SolutionT...
About Apache Camel's Message Forwarding Efficiency
Test ScenarioThe company uses ActiveMQ and Camel for message distribution. Previously, the data volume wasn’t very large, so we never really considered efficiency issues, and the research into Camel’s working principles wasn’t deep. However, recently, as the business volume increased, Camel’s efficiency has gradually become a bottleneck, so I got a general understanding of Camel’s working principles based on logs. Although Camel is embedded into ActiveMQ, during the working process, Camel and...













