Middle+
IMemoryCache What are the pros and cons of using IMemoryCache in an application? What is OWASP top 10? Code metrics 1. What code quality metrics do you know? 2. Have you used them? 3. How did you calculate them? 4. Part of CI or adhoc Load What will you do if your service (web page) hangs on the test or load circuit, but locally everything works?
sobes.tech AI
Answer from AI
IMemoryCache — pros and cons:
Pros:
- Fast access to data in memory without network delays.
- Easy to use and integrate.
- Suitable for caching frequently requested data.
Cons:
- Limited by server memory capacity.
- Not a distributed cache, not suitable for scalable applications with multiple instances without additional synchronization.
- Data is lost upon application restart.
OWASP Top 10 is a list of the 10 most critical security risks for web applications, compiled by the Open Web Application Security Project. It helps developers and companies focus on main vulnerabilities such as SQL injection, XSS, improper authentication, etc.
Code quality metrics:
-
Known metrics:
- Test coverage
- Code complexity (Cyclomatic Complexity)
- Number of bugs per 1000 lines of code
- Code duplication
- Static analysis (lint)
-
Used — yes, for example, test coverage and code complexity.
-
Measured with tools: for C# — SonarQube, Coverlet, Visual Studio Code Metrics.
-
Metrics are usually integrated into CI/CD pipelines to automatically monitor quality at each commit.
If the service hangs on a test or load test environment but works locally:
- Check logs and metrics on the test environment to identify bottlenecks.
- Analyze differences in configuration, software versions, load.
- Use profiling and tracing to identify locks or long operations.
- Optimize code or infrastructure (e.g., increase resources, add caching).
- Conduct load testing locally with near-production load.
- Consider scaling the service or using queues for asynchronous processing.