Posts

GCP Serverless Function in Java with 15Mb RAM

  The blog is more about experimenting with Java Native build to achieve less RAM use. Usually, when using Java as a runtime for Google Cloud functions ( https://cloud.google.com/functions/docs/concepts/java-runtime ) the average RAM footprint is about 140 MB for a simple REST API Jax-RS based endpoint with JSON (text) static response. For example, the same example in Golang (one HTTP GET method) with JSON response is around 30 MB RAM. To try to achieve less RAM footprint with Java (e.g. to use 128 MB GCP tier), let us try to use: - Java Socket as very simple HTTP server - GraalVM Native build - Docker - Google Cloud Run to use custom Docker image as an app Java code Source code :  https://github.com/ahndmal/http-simple-sock-native We create ServerSocket and accept connections on port 8080: try ( ServerSocket serverSocket = new ServerSocket ( 8080 )) { System . out . println ( ">>> Server started on port 8080" ); while ( true ) { Socke...

How to update Contents in Confluence via REST API

  here are some options about how to use Confluence REST API to operate on pages/blogs/comments/etc., but there are some peculiarities of how to use it in some non-standard cases. The Confluence SERVER REST API link is  https://docs.atlassian.com/ConfluenceServer/rest/7.16.2/ , and CLOUD REST API -  https://developer.atlassian.com/cloud/confluence/rest/ . They are almost the same in simple operations like page creation or update, but differ a lot in its use for complex cases. So, our task is to update the branch of pages in TEST Confluence space, to find and replace  Patch008  text to  Patch009 . Yes, illogical operation, but anyway it is to give the example :) We need to: Get descendant pages of the root one Get bodies of those pages Find and replace the text in page bodies As we know the ID of the root page (let it be  12345 ) we can use REST API to to get descendant pages. We will use Groovy language, but the process is pretty the same for other too...