The database is large, indexes are built, the plan has been reviewed — what else can be done for optimization?
Java
What caches are available in Hibernate?
Why did you increase the connection pool size under high load and how is this different from increasing the total number of requests?
import java.util.Arrays; import java.util.HashMap; import java.util.Map; public class badCounter { public static Map<String, Integer> mapOfBadNames = new HashMap<>(); protected void doProcessing(String filePath) throws IOException { try { FileInputStream fis = new FileInputStream(filePath); BufferedReader br = new BufferedReader(new InputStreamReader(fis)); while((br.readLine())!=null){ processWords(br.readLine()); } br.close(); fis.close(); } catch (IOException | NullPointerException ex) { System.out.println(ex.getMessage()); } } private void processWords(String line) { Arrays.stream(line.split(" ")) .map(String::trim) .forEach(word -> { if(mapOfBadNames.containsKey(word)){ mapOfBadNames.put(word, mapOfBadNames.get(word)+1); } else{ mapOfBadNames.put(word, 1); } }); } public void writeResultToFile(String path) throws IOException { try { PrintWriter out = new PrintWriter(path); out.println("word,frequency"); for(Map.Entry<String, Integer> entry : mapOfBadNames.entrySet()){ out.println(entry.getKey() + "," + entry.getValue()); } out.close(); } catch (NullPointerException | IOException ex) { throw new RuntimeException("Error writing to file", ex); } } public boolean isEverythingFine() { return true; } public static void main(String[] args) { badCounter bcn = new badCounter(); try { bcn.doProcessing("bad_input.txt"); bcn.writeResultToFile("result.csv"); bcn.doProcessing("bad_input1.txt"); bcn.writeResultToFile("result1.csv"); } catch (IOException ex) { System.out.println("Something went wrong"); } } }
Tell us about the principles of SOLID
Why is the Repeatable Read isolation level needed in this context and is it necessary?
How are consumers distributed across partitions: does each consumer connect to each partition or not?
Did the application connect directly to PostgreSQL or through an intermediate component?
What is RAG from the document perspective — what kind of documents are they and how are they prepared?
The product came with a request to develop a Loyalty service, which based on the number of delivered orders (master system for orders OMS) will give the order processing service (cashier) a discount amount. The Loyalty service will not have a front-end part for now, only in the database, a mapping of how much discount corresponds to the number of delivered and not canceled orders should be stored. Something like Orders Discount [phone]% [phone]% [phone]% [phone]% It is necessary to design the service, propose integration mechanisms with the Order Processing Service and the Order Management Service. Design the architecture of the service that can be handed over to the development and deployment team.
How to protect a controller by roles in Spring Security?
Tell us about the projects, technologies, and technical challenges you have worked on.
If you increase the number of partitions from one to ten, how to evenly distribute messages among them?
Why couldn't you just scale the synchronous API, add application instances, or database capacity instead of Kafka?
What is your overall experience in IT?
You mentioned that you accelerated operations from 600 to 100–150 ms. What technologies and solutions made this possible?
How does HashMap place objects in tree bin if the key does not implement Comparable?
Are you familiar with the outstaffing model?
In what cases would you use @Async?
How to implement two integration implementations: a real one for production and a mock for testing?