OpenEnergyPlatform / oeplatform

Repository for the code of the Open Energy Platform (OEP) website. The OEP provides an interface to the Open Energy Family
http://openenergyplatform.org/
GNU Affero General Public License v3.0
61 stars 19 forks source link

OEP performance poor - page load time, parsing of internal files (oeo) & database queries (sqlalchemy2) has been slowing down recently #1590

Open jh-RLI opened 4 months ago

jh-RLI commented 4 months ago

Description of the issue

The OEP and its user-facing functions have never been as fast as you would expect from a modern website. Of course, we mainly work within the framework of our research projects, but we also want to build a well-known infrastructure and be open to more users. This issue is about performance in general. There are several issues that raise more specific questions. I will link to these here in the future.

My main argument as one of the main developers of this software is that we should at least keep our infrastructure up to date with reasonably recent software versions. That doesn't mean we have to update our server every week, but I don't think we've updated the infrastructure since 2016.

Which parts of the OEP are affected

Possible solutions

Some of the problems may have to do with the growing functionality and database queries, others can be solved by improving the implementation (e.g. better caching and more). One of the main problems is that we have to use very old software components.

Unfortunately, I can't take on these tasks as I don't have access to the infrastructure backend. I would be happy if we can make a plan on how to proceed and what options there are.

tillmo commented 4 months ago

Please be more specific. Which parts are particularly slow or slower than before. I guess: loading large database tables?

jh-RLI commented 4 months ago

@tillmo that's right, that wasn't my best description. Now I have updated the issue as I originally intended. Please read the text above again if you have the time. This issue is more of a meta issue. I've listed the main problems, but there are also other, more specific issues here on GitHub as well. I will link them here once i have the time.

MGlauer commented 4 months ago

All these issues do not sound like issues that are OS-related, but sub-optimal backend design (when it comes to the data-view probably on my end). Regarding the ontology-overview in particular: As far as I understand, the ontology files are parsed for every single request. Considering that these files only change on a bi-monthly basis, I would recommend implementing a method that loads the required information into a Django-Model on start-up or manually using a django-command that can be triggered when new files are available.

jh-RLI commented 4 months ago

Of course I agree, but that's only part of my point. It is always possible to optimise the implementation. I can confirm that your understanding is correct and I also plan to implement the solutuion that way. It might even be enough to cache the function that reads the oeo files. Then it will only be returned when the server is restarted.

I think I mixed my argument too much with my attempt to also address the importance of some of our current problems, because that's what was asked about. I'm not saying that we can't improve implementation if we keep our current infrastructure and the software versions within it. I'm saying that we see more and more issues when we update packages (PyPi) and that we want to be open to collaboration and forcing developers to use the old Python version. I think it would be worthwhile to update this so that we can move faster and not waste a lot of time fixing bugs related to old Python package versions. As a side effect, this will also lead to a bit more performance.