Now it is obvious that ^realglobal has 11.3 times the size of ^testglobal
while your ^testglobal seems to have all blocks in buffers in memory
this is rather unlikely for ^realglobal.
So repeated reloading of blocks from disk seems to cause the delay
If you have the chance to double or triple your global buffers
you most likely may see improved processing of your $O()

Follow up to @Dmitry Maslennikov:
Error on IRIS side:  ACCESS DENIED  ODBC can't connect ===> timeout
Why  ACCESS DENIED ? 
The most likely cause

  • you run multiple ODBC connections in parallel
  • you use the same fixed USER for access to IRIS
  • maximum license slots by user is ~25
  • once you pass the limit your 25 slots get converted to 25 single licenses
  • any further connection consumes a full license 
  • until you run out of available licenses ==> ACCESS DENIED
  • you can get out of that trap only if ALL connections of that user are closed 

You can avoid this by

  • limiting your ODBC connections below 24
  • or run your ODBC access in  serial mode
  • or use multiple users for access with limit <24