Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Is NIO all its cracked up to be?  (Read 1290 times)
0 Members and 1 Guest are viewing this topic.
Offline CaptainJester

JGO Knight


Medals: 10
Projects: 2


Make it work; make it better.


« Posted 2010-05-10 19:28:36 »

According to a Google engineer it's not.

[rul=http://paultyma.blogspot.com/2008/03/writing-java-multithreaded-servers.html]Writing Java Multithreaded Servers - whats old is new [/url]

Any thoughts.

Online Riven
« League of Dukes »

JGO Overlord


Medals: 439
Projects: 4


Hand over your head.


« Reply #1 - Posted 2010-05-10 22:20:54 »

Surely NIO has its downsides:
- own code complexity
- slightly less performance than recent threading models
- horribly designed java.nio API

One upside remains:
- few threads

Every thread requires ~1MB of RAM. With thousands of connections that is a problem, unless you want to add >8GB of RAM to your system, *only* for handling your threads. For true multiplexing (not request=>response) you actually need 2 threads per connection, making the memory problem even worse.




Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Offline delt0r

JGO Coder


Medals: 18


Computers can do that?


« Reply #2 - Posted 2010-05-10 22:34:30 »

Linux NPTL is not avalible everywhere. When non blocking nio was released, these type of thread developments where clear. Its not the solution to every problem.  Now that we all have multi core machines, its it any surprise that multi threaded can do well?

Even better have n threads where each handles m connections. Where n & m can be tuned. 

However in my game i get big gains with simplicity of debugging and mutex management by having a single network thread. The API follows a fairly popular C api as i understand, and didn't find it hard to use. Also thread synchronization can be quite slow, but mainly because the hotspots can't optimize the crap out sections of code with lots of synchronization code.


I have no special talents. I am only passionately curious.--Albert Einstein
Games published by our own members! Check 'em out!
Try the Free Demo of Revenge of the Titans
Offline Orangy Tang

JGO Kernel


Medals: 48
Projects: 11


Monkey for a head


« Reply #3 - Posted 2010-05-11 11:00:11 »

Quote
I've encountered some very strong misperceptions

Quote
Then ran them for me on his 768core Azul box

Well yes, I imagine quite a few "misconceptions" go right out of the window when you're working on highly specialised hardware with hundreds of cores. For the rest of us who aren't working at google and have to deal with much more run of the mill hardware I don't see how this is really relevant.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Online princec
« League of Dukes »

JGO Kernel


Medals: 196
Projects: 3


Eh? Who? What? ... Me?


« Reply #4 - Posted 2010-05-11 13:02:43 »

Well, some of the discussion revolves around the relative simplicity of doing things the "old" way (1 thread to 1 client connection).

Cas Smiley

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (106 views)
2013-05-17 21:29:12

alaslipknot (114 views)
2013-05-16 21:24:48

gouessej (143 views)
2013-05-16 00:53:38

gouessej (139 views)
2013-05-16 00:17:58

theagentd (151 views)
2013-05-15 15:01:13

theagentd (135 views)
2013-05-15 15:00:54

StreetDoggy (179 views)
2013-05-14 15:56:26

kutucuk (202 views)
2013-05-12 17:10:36

kutucuk (203 views)
2013-05-12 15:36:09

UnluckyDevil (209 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.098 seconds with 20 queries.