Roland Häder is now friends with admin
Roland Häder is now friends with admin
I'm currently developing (free time project) a Java Server Faces application which uses the #JPA (very common to do so) over EJBs (Enterprise Java Beans). When I turned on logging of SQL queries, I thought I didn't see it right. For each entity ("row" in database table) a distinct query has been issued. Means, when I have 1,000 rows, the same amount of queries are being issued.
This can become a nightmare when "only" 100 users are on the server. Does someone know how to reconfigure the JPA (I use #Payara ) to issue only one SQL query per table?
Surely I have used JPQL (Java Persistence Query Language) and no WHERE
was used there. So normally the whole table should be fetched. But this is not the case for linked tables (e.g. with @OneToOne
) where each such referenced entity is being fetched distinctly.
So is there a way to prevent this from happening? RAM is not a issue here. 16 GB are installed and data will not grow so much.
Ich wurde hier #aufarbeit angesprochen, ob ich [bold]hier[/bold] auf #Facebook unterwegs sei ... Ja, ist verwechselbar, wenn man sehr ungenau hinsieht. Vielleicht hat er sich an dem Favicon festgeklammert?
Naja, nicht als Kritik oder FB-Bashing verstehen, was damit auch nicht beabsichtigt ist, ich weis sehr wohl, dass Friendica != Facebook ist, da es eine freie Alternative ist.
Ich finde es halt etwas bedenklich. Ich musste nachkorrigieren und sagen, dass es nicht FB, sondern Friendica ist. Mal schauen, vielleicht wechsel ich das Theme? Sieht es wirklich so verwandt mit FB aus? Finde nicht, hier ist vieles weiss und grau, bei FB weiss und blau.
I currently have a glass stuck in a porcelain. I have already setup cold water in top glass and hot (boiling, I'm careful) around lower but still they remain stuck. Plus I added salt in upper (cold) glass. I got this (last) idea from a #youtube video with ID #HOglOnne3As which seems quite straight-forward but still no success here.
Any ideas? I cannot currently upload images, size limit of 780k exceeded but I set $a->config['system']['maximagesize'] = 2*1024*1024;
which should be enough, right?
Strange #bug in #Friendica ... So you have to live with a link to my #nextcloud instance: cloud.mxchange.org/s/rnFtrpbQq…
Roland Häder🇩🇪 likes this.
I have managed to bring back my #searx instance at
back working again. I had updated my Apache installation to 2.4 and forgot to change the settings to Require all granted
.
Feel free to use it (on your own risk, careful: adult content is possible to find).
like this
@Friendica Support I had always a working XMPP instance on my friendica instance. Now it doesn't connect. I have enabled debug log in .htaconfig
file but nothing is written there.
With pstree I can only see beam.smp with 18 beam.smp threads but no ejabberd_auth.php sub process which did happen before. strace tells me that it tries to read from 0 (stdin) so it seems to wait for input. Access rights and correct user/group are set (0700, ejabberd.ejabberd according to documentation). Yet still it isn't starting.
Any ideas what might cause this?
<IfModule mod_proxy.c>
<IfModule mod_proxy_http.c>
ProxyPass /http-bind http://127.0.0.1:5280/http-bind retry=0
</IfModule>
</IfModule>
# netstat -lnp|grep 5280
tcp 0 0 127.0.0.1:5280 0.0.0.0:* LISTEN xxxxx/beam.smp
#
Roland Häder is now friends with Holger (Hubzilla)
Frank Dapor #podmin likes this.
Today I have one of the very rare opportunities to have a relatively quiet and calm office room for myself, my workmate is ill and others are not in. Only sometimes the CEO comes in.
Will use that moment to program and focus more.
Adam Magness likes this.
I have just pushed a pull request for #PrimeFaces on #GitHub. Let's hope, they accept it.
Here is the link:
Wenn #Unkenntnis von Nicht-ITlern zum Ende des Vorzeigeprojektes #LiMux wird, hat der Verstand versagt. Einfach peinlich, was da abgeht ... Und dann sich beschweren, dass Linux eingeschränkt ist?! Hackt es? Ja, die #NSA-Software namens #Skype kann nicht unbeobachtet installiert werden, oh wie schade aber auch ...
#ReScam "redet" sogar mit einem ...
I'm currently looking for a proper translation for the German word Pfand. Here in Germany we have 25 EUR cents on some plastic bottles (not all) like soft drinks or even caned drinks (not all cans).
When we bring that empty bottle/can back to the supermarket and put it there in a machine for one-way-bottles/cans, then we can that 25 EUR cents back for each bottle (that has a proper symbol on it's cover printed).
dict.cc gives me a lot words for this: pawn, collateral, mortgage, pledge, deposit, forfeit, earnest, security, gage. I can rule out 2,3 and 5, 6 sounds strange. Any ideas which might be the right one?
Roland Häder🇩🇪 likes this.
Roland Häder is now friends with Adam Magness
Adam Magness likes this.
When editing #Friendica code, I use a local commit hook, finding leading and trailing white-spaces. The hook itself is GIT's default pre-commit
hook plus a few extra lines:
# Find bad scripts
./util/typo.php
# PHPUnit
if [ -x ./vendor/bin/phpunit ]
then
./vendor/bin/phpunit || exit 255
fi
So, please don't wonder when I touch "the whole file". Then I have just changed DOS -> Uni* line-break (CRLF
to LF
) as it was being detected as trailing white-space characters.
Frank Dapor #podmin likes this.
Browsers (even #Firefox #Quantum) tend not to download CSS/JS when they have downloaded it already. This forces your users to press CTRL+F5
(under Firefox at least). The fix is to include a version number in the URL and always increment it when you change something.
Examples: /js/main.js?v=1.0.0
or /css/default.css?v=1.0.0
Static files normally ignore parameters so this is safe to do so. When you change that file, just increment the last patch number until you want it (I prefer to increment from 1.0.9
to 1.1.0
but that is up to the community (you should come up with a versioning convention). #cache-busting
Roland Häder🇩🇪
in reply to Roland Häder🇩🇪 • •Maybe I need to explain more about my program. On initialization of the backing bean (means when an instance is being created and the web container is creating a wrapper class around it) I load the entire table rows from the EJB to into the controller to cache it there (see #JCache #JS107 ).
This gives great performance improvement due to not with every request (POST/GET) data is not being loaded from database but taken from cache. This is what I call asynchronous loading of data, most PHP applications however are synchronous, means with every click data is fetched from database and scripts are loaded and parsed (OpCache is maybe a bit improving here) and are being "forgotten" after the request was finished.
But with a JSF application, the "controller" (backing bean) remains instanced (and wrapped) in the web container's heap until you redeploy the application or restart the web container.
So sure I want to use that advantage of having all loaded at "all" (not at the beginning, but you can implement a ServletContextListener interface where you can "hook" on the initialization phase) times. Still this issue is there.
As you can see, not on every request these SQL queries are performed (which is very good for overall performance) but still they are really a lot. Just imagine 1,000 users on your web server (you may need a cluster then) and several 10,000 records.
Sure, when you cache them all in RAM, then you need a lot RAM. The #Payara application server uses here #Hazelcast ( hazelcast.com/ ) for having a distributed heap (cluster members contribute their heap to the cluster) and JCache (JSR107).
So what now? I still found this a bit to much. Currently I use eager fetch-mode, I could switch to lazy but that only delays the problem as foreign entities are being lazyless (on getter invocation) loaded.
Roland Häder🇩🇪
in reply to Roland Häder🇩🇪 • •Roland Häder🇩🇪
in reply to Roland Häder🇩🇪 • •Roland Häder🇩🇪
in reply to Roland Häder🇩🇪 • •I understand and know what AJAX means and I'm not targeting PHP or labeling it as bad and "look how cool this or that is". No, that is not my style.
Back to my issue, the #JPA (Java Persistence API) fetches records from database, creates an instance for each record of your entity class and wraps it into a proxy class. Then that proxy class is being compiled and most JPA implementations are caching them (the entity manager does this). This has nothing to do with the application or that it uses AJAX. My main goal is to reduce invocations of EJB business methods as this is "expensive" (a lot code need to be executed).
Just imagine, you can deploy your model classes on an other server or even data center and from your backing bean's perspective you have to change nothing at all as all is encapsulated away for you (most #JavaEE application servers use #CORBA for serializing and deserializing data).
Means on one server (or cluster, doesn't make a difference in Java code) you have your web "controllers" (they are not called controllers, backing beans are the right words for them) and on the other your model classes are running. This means one thing: distributed application load.
BTW: Amazon is running on Java Server Faces, when you hit the "order" button, EJBs are being invoked.
Okay, I'm explaining to much off-topic. With "synchronous" I mean with every request (even AJAX requests as they are basically HTTP requests. too) data is being fetched from the database. With "asynchronous" this is not the case. And I mean with this, that data is not being fetched from on each database, but maybe from a cache (that needs to stay updated, of course).
Roland Häder🇩🇪
in reply to Roland Häder🇩🇪 • •Okay.
I have found something programmatic (with annotations) for this, but it looks a bit like an overhead when you have +20 entities. What I would prefer is a 3rd fetch type
ALL
to the existingEAGER
andLAZY
. That would have to go into JPA specification, of course which made all persistence providers, like #eclipselink , #hibernate, #datanucleus and so on unified as before every provider did it on their way.This is why I like the JPA, because it is dbms-independent and provider-independent at the same time. No need to worry if your data is stored in a SQLite, MsSQL, Oracle DB or good-old MySQL or even "exotic" database systems like MongoDB.
Roland Häder🇩🇪
in reply to Roland Häder🇩🇪 • •Roland Häder🇩🇪
in reply to Roland Häder🇩🇪 • •@NamedEntityGraph(s)
were the annotations I was looking for.Roland Häder🇩🇪
in reply to Roland Häder🇩🇪 • •Roland Häder🇩🇪
in reply to Roland Häder🇩🇪 • •Roland Häder🇩🇪
in reply to Roland Häder🇩🇪 • •Hard to say as you cannot compare PHP and Java as they are fundamentally different languages. PHP is type-lazy (allows no type at all) and Java is type-safe (unless you do "unsafe casts").
To answer your question, I like both, if that satisfies your question.