Skip to main content

Posts




Agentic AI Development- Optimization- Bedrock Claude

Most of the models which you wish to invoke via AWS Bedrock, GPT, Google, etc, charges per token ( words/ characters ) For example -  A model like Claude is not a computer program that executes instructions. It is a statistical pattern matcher trained on text. It has no CPU, no memory, no ability to run code. It only predicts the next most likely token based on patterns it saw during training. But, some AI platforms give the model a sandboxed Python environment to actually execute code. Bedrock does have a Code Interpreter tool in Bedrock Agents — but that's a completely different setup- the overhead of setting it up just to decompress JSON makes zero sense when simply sending clean JSON is trivially easy. Easy Way To Estimate Your Cost- Step 1 — Measure your actual prompt size: Take your evidence JSON + instructions Paste into: https://platform.openai.com/tokenizer (OpenAI's tokenizer is close enough for estimation) It will tell you exact token count Step2 - Cost calculation C...

VPN testing checklist

 To test: Is VPN active? Is it leaking? Does it look residential? Does it alter network fingerprints? Public IP Test (Basic Detection) - curl ipinfo.io DNS Leak Test - nslookup google.com MTU Test (Encapsulation Detection) - ping 8.8.8.8 -f -l 1472 TCP MSS Inspection - Use Wireshark and Look for SYN packets. Traceroute Path Test - tracert 8.8.8.8 WebRTC Leak Test - browserleaks.com/webrtc IPv6 Leak Test - test-ipv6.com Latency / Jitter Test - ping -n 50 8.8.8.8. VPN usually causes: More Jitters and Latency. Reverse DNS (PTR Record) - nslookup <your-public-ip> IP Reputation Check - Like most IP's from VPN Providers like Express VPN, etc. are blacklisted and all. Look for: Proxy/VPN classification, Hosting provider tagging

Unix Server ( Edge Node ) hangs when there are many jobs running on hadoop cluster started from Unix Edge Node.

  When a unix server or an edge node is running lots of jobs (like Spark, Hadoop, or custom batch processes), crashes happen. For example. For example a process might hit a segementation fault, memory issue or ay other runtime issue. By default, if ulimit -c is not 0, the OS will create core dump. Core dump are written to disk and can be very large, sometimes hundreds of MBs or even GBs per process. What we realized was that when multiple processes crash at the same time, the system suddenly tries to write core files to disk. This was leading to DisK I/O spikes. Thus, node was becoming unresponsive. This was also leading CPU spike because OS was handling crash logging. Setting "ulimit -c 0" disables core dumps. This way we lose ability to debug crashes via core dump But, kept production edge nodes stable. On most Linux systems, by default, "core dumps" are written in current working directory of the process that crashes. Linux allows you to change core dump file nam...

Spark leading to ClassNotFoundException for corrupt jar files instead of ZipException

  When Jar passed via --jars that leads to following error - zip END header not found Same Jar passed as application jar file leads to following error - ClassNotFoundException These two errors are not contradictory. They mean Spark is touching the Jar in 2 completely different code paths. --jars Jars are: Downloaded Immediately unpacked/ inspected Added to executor classpath eagerly. Thus if Jar is bad. Spark tries to open it as ZIP, which leads to ZipException. When used as application Jar: Spark does minimal Zip validation. Only checks enough to start Loads manifest + class index Attempts to resolve --class if: The Jar opens. But the expected class isn't there, which leads to ClassNotFoundException So: Spark never deeply unzips it Corruption in unused entries may go unnoticed Outcomes: As app JAR -> Spark reads just enough -> ClassNotFoundException As --jars -> Spark fully opens ZIP -> zip END header not found

Clone multiple projects or repositories from GitLab under a folder or subfolder.

  Suppose we have a group named as groupA in gitlab, under which we have sub folder structure, and there are multiple projects under a folder.  We wish to clone all the projects under folder. This can be done using gitlab api. Like below -  1) You should have Token for authentication. TOKEN="J612a-xUoMxxcerssRe31_" 2) API URL to subfolder that should give you group id.  API_URL1="https://<gitlab.server.com>/api/v4/groups?search=groupA /dir1/dir2/dir3/dir4" 3) Use below to get group id - GROUP_ID=$(curl --silent --header "Private-Token: $TOKEN" "$API_URL1" | jq -r '.[].id') 4) Now you can fetch and clone all projects by using below - API_URL2="https://<gitlab.server.com>/api/v4/groups/$GROUP_ID/projects" # Fetch repositories list REPOS=$(curl --silent --header "Private-Token: $TOKEN" "$API_URL2" | jq -r '.[].http_url_to_repo') # Clone each repository for REPO in $REPOS; do     git clone $RE...