Please do NOT hardcode superuser privileges into the application; rather,
instead of assuming daemon threads are always superuser, let Daemon
decide.  Authorization should be delegated to Daemon & not assumed to be
superuser – i.e.,

if (Daemon.isDaemonThread())
  return Daemon.hasPrivilege(privilege);

This will allow Daemon to be more flexible down the road – e.g., if a
non-superuser with appropriate privileges installs or starts a module,
Daemon could execute the module in a thread with privileges matching that
user rather than as superuser; daemon threads can run with the minimum
necessary privileges; etc.

Cheers,

-Burke

On Wed, Sep 7, 2011 at 10:16 PM, Jeremy Keiper <[email protected]> wrote:

> Thanks, Darius ... I'll take a look at the core fix for the daemon user.  I
> should have a snapshot that is for "normal" ORU^R01 messages, not using the
> specialized lab processor, that can show you the saveEncounter() slow down;
> hopefully I can provide that for you sometime early tomorrow.
>
> Jeremy Keiper
> OpenMRS Core Developer
> AMPATH / IU-Kenya Support
>
>
>
> On Wed, Sep 7, 2011 at 6:38 PM, Darius Jazayeri <[email protected]>wrote:
>
>> Hi Jeremy, (copying the dev list)
>>
>> I looked at the snapshot. It's not as helpful as they often are.
>>
>> Some things I noticed:
>>
>> HibernateContextDAO.getUserByUuid(String) is taking a massive amount of
>> time. The underlying issue is that @Authorized checks lead to a call to
>> Context.getAuthenticatedUser(). But when you're in a Daemon thread, that
>> causes a database query (via contextDAO.getUserByUuid). *I believe
>> there's a trivial fix to core that will save 10-15% of your CPU time.* In
>> the beginning of AuthorizationAdvice.before, add something like:
>>
>> if (Daemon.isDaemonThread())
>>     return;
>>
>>
>> Your LabORUR01Handler.processLabORU_R01 method is spending 60% of its time
>> doing saveObs(Obs, String). Presumably if batches of lab results were saved
>> in encounters, that'd be faster. But that's a significant change for you.
>>
>> -Darius
>>
>

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to 
[email protected] with "SIGNOFF openmrs-devel-l" in the  body (not 
the subject) of your e-mail.

[mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]

Reply via email to