We are developing with IBM.EntityFrameworkCore and netcore version 7 with imb license to deploy it in aks, however whenever you connect the first time to the database exceeds 30 seconds but if you connect again it takes 1 second, we have done tests and we have evidenced that this happens only when you have inactivity, question this is normal? or what should we do so that the connection to the database db2 is not delayed too much?
example code
public ClienteEntity ObtenerCliente(int id)
{
try
{
using (var context = new MiDbContext()) // Usa tu clase DbContext
{
var entidad = context.ClienteEntities
.AsNoTracking() // Opcional: mejora el rendimiento si no vas a modificar el objeto
.FirstOrDefault(e => e.Id == Id);
return entidad ?? new ClienteEntity();
}
}
catch (Exception)
{
throw;
}
}
Add logs

------------------------------
Marco Ayala
------------------------------