microcks: Error storing daily statistics

Hi,

I’m getting this error below when calling to a REST mock. I’m running microcks on k8s with 3 pods and trying to find the performance of the application.

11:14:28.072 [ERROR] org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler - Unexpected exception occurred invoking async method: public void io.github.microcks.listener.DailyStatisticsFeeder.onApplicationEvent(io.github.microcks.event.MockInvocationEvent) org.springframework.dao.IncorrectResultSizeDataAccessException: Query { "$java" : Query: { "day" : "20220103", "serviceName" : "First Mock API", "serviceVersion" : "1.0.0"}, Fields: {}, Sort: {} } returned non unique result. at org.springframework.data.mongodb.core.ExecutableFindOperationSupport$ExecutableFindSupport.oneValue(ExecutableFindOperationSupport.java:139) at org.springframework.data.mongodb.repository.query.AbstractMongoQuery.lambda$getExecution$4(AbstractMongoQuery.java:159) at org.springframework.data.mongodb.repository.query.AbstractMongoQuery.doExecute(AbstractMongoQuery.java:132) at org.springframework.data.mongodb.repository.query.AbstractMongoQuery.execute(AbstractMongoQuery.java:107) at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137) at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121) at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:152) at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:131) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:80) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) at com.sun.proxy.$Proxy106.findByDayAndServiceNameAndServiceVersion(Unknown Source) at io.github.microcks.listener.DailyStatisticsFeeder.onApplicationEvent(DailyStatisticsFeeder.java:71) at io.github.microcks.listener.DailyStatisticsFeeder.onApplicationEvent(DailyStatisticsFeeder.java:38) at jdk.internal.reflect.GeneratedMethodAccessor67.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)

In case this is not easy to solve, would it be possible to disable daily statistics? I’ve checked the code and there is no property to do it right now

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (13 by maintainers)

Commits related to this issue

Most upvoted comments

The use-case is great! In case you’re happy with what you’ve done and want to share more, we welcome contributions to our blog https://microcks.io/blog 😉

I would love to contribute for sure!!! Once I’m done with all the work I want to do we can consider it!!

Regarding monitoring, I am currently working on #411. It will bring Prometheus exporters for webapp and async-minion components.

That would be perfect!! Yes, I’ll keep an eye to that one as well, it would be really useful for my use case

About my use case, it might be a bit different from other users but I think is quite valid. I’m planning to use Microks to decouple dependencies between several services during Load Testing. Basically, I want to exercise different parts of my system individually in different Load Tests and I want to configure mock APIs using Microcks.

The reason for this is to have a clear understanding of how my components will perform individually before checking the whole system.

I think Microcks will be able to do this work quite well using the flag we’ve been discussing.

I have a few more ideas if you want I’ll be happy to discuss (ideas which will involve better monitoring for microcks)

Perfect!! I would be happy to do some performance testing with different options to understand the impact of each change. Maybe we can check with and without statistics in both spring boot versions if that’s available.

I would love to help!

Hi @lbroudoux Sure! I’ll contact you on LinkedIn

Just created #541 to track the evolution related to adding a flag for disabling analytics.

I’ve just checked the new image and the performance is outstanding!

I can manage to get 1.5k+ transactions per second with the same configuration as before. (3 pods in a k8s cluster with limit cpu to 1 core) I think there is no problem at all with Spring Boot upgrade and probably the event processing was consuming resources and decreasing general performance.

I’ll keep a longer test running to ensure performance is not degrading along time and come back with more results, but I can say that right now without that even processing it is performing absolutely great!

I would say you can implement that flag to enable or disable statistics and people interested in them would be able to benefit for that future and maybe users like me looking for pure performance will be able to get the best from the tool.

What do you think?

Hi @lbroudoux Maybe the decrease in performance I found might be caused by other situations, I can double-check with that tool you mentioned and share some results if you need them.

Anyway, that flag we are talking about will give us the final response about the impact on performance so I will stay tuned and will perform as many checks as we need once it is introduced if you are ok with that.