Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ImageGen with load balancer (cluster) (Read 3721 times)
krilbert
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Jul 20th, 2011
ImageGen with load balancer (cluster)
Jul 20th, 2011 at 6:00pm
Print Post  
Hi, we developt our application and everything is going great, but right now we publish it on a Load Balancing architecture and we are running through some troubles.

The thing is that sometimes the diagramview displays the image and sometimes it doesnt.

My guess is that, since the image is being created and stored in a session variable (dataIdParam), the server request the ImageGen file before the image is created and thats why we cant see anything. Is there a workaround to this?

Thks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ImageGen with load balancer (cluster)
Reply #1 - Jul 20th, 2011 at 6:46pm
Print Post  
Hi,

Could you try specifying a different SessionStateMode in your web.config as described here?
http://msdn.microsoft.com/en-us/library/ms178586.aspx

The image data is generated and stored in the session state when generating the IMG html that will be sent to the browser, so you should not receive a request for the image before it is generated. However from what I understand, the default InProc SessionStateMode will cause the session data to be unavailable if the balancer sends the ImageGen request to a different server on the farm.

Stoyan
  
Back to top
 
IP Logged
 
krilbert
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Jul 20th, 2011
Re: ImageGen with load balancer (cluster)
Reply #2 - Jul 20th, 2011 at 7:51pm
Print Post  
Hi i really appreciate the quick response. In fact we have already done that, we are using SQLServer in every app in the farm. This is how the webconfig looks like:

<sessionState mode="SQLServer" sqlConnectionString="data source=DATABASE;Initial Catalog=ASPState2;user id=usr;password=pass" allowCustomSqlDatabase="true" cookieless="false" timeout="20"/>

Just to be on the same context, on the page load we create the diagram programatically like:

Diagram diagrama = DiagramView1.Diagram;
Factory factory = d.Factory;
...

This is why i think the image can be even in construction while the server is requiring the ImageGen.aspx. Am I right?

The thing is that sometimes we can see the diagram and sometimes we cant. What are we missing? is there a specific way to deploy on this kind of scenary? currently we are talking about 3 servers.

Greetings
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ImageGen with load balancer (cluster)
Reply #3 - Jul 21st, 2011 at 8:11am
Print Post  
Hi,

The control first saves the image data and afterwards sends an <img> element to the browser:

Session[imageId] = GenerateImage(...);
output.Write(CreateImageMap(...));
output.Write("<img src=ImageGen.aspx...");

So, at the time the browser loads the IMG element whose SRC is set to ImageGen, the image bytes are already in the session state. The session data serialization is synchronous from what I can understand (http://msdn.microsoft.com/en-us/library/aa479041.aspx#aspnetsessionstate_topic3), and it should not be possible the browser to send a GET ImageGen request before the data is actually saved in SQLServer.

Are you by chance creating large diagram images? GDI+ cannot create bitmaps larger than about 3000x3000 pixels, and if your diagrams get larger than that you won't get an image displayed. If that's the case, try setting the MaxImageSize property to make the control split the diagram into several smaller bitmaps.

You might also check if the SQLServer session table has some memory limits set for the serialized session-data fields. If the field max. size seems smaller than the generated bitmaps, try increasing it.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
krilbert
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Jul 20th, 2011
Re: ImageGen with load balancer (cluster)
Reply #4 - Jul 21st, 2011 at 4:48pm
Print Post  
Hi, thks for the explanation. Our diagrams are not that big, in fact most of them should be less than 1000x1000 and they always show up on the one server.

To be honest i cant find where to check that memory limit on the SQLServer session table. Could you please guide me thought that
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ImageGen with load balancer (cluster)
Reply #5 - Jul 22nd, 2011 at 7:22am
Print Post  
I suppose you can take a look at the ASPStateTempSessions table using SqlServer Management Studio. I can see a SessionItemShort and SessionItemLong fields there after running the InstallSqlState script, but am not sure how they are used. Anyway we don't have a working server cluster right now, we'll try to set up one for testing next week.

Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ImageGen with load balancer (cluster)
Reply #6 - Oct 26th, 2011 at 7:46am
Print Post  
We have finally managed to setup a load balancer to test this. Have you by chance specified a common machine key for encrypting the session state as explained below?
http://technet.microsoft.com/en-us/library/cc731979(WS.10).aspx

The article here mentions common machine keys are required for StateServer mode, but we had many problems (e.g. embedded scripts failing to load) in SQL mode too until we assigned the same machine key to all servers in the cluster:
http://msdn.microsoft.com/en-us/library/ms178586.aspx

After doing that, everything seems to work fine now, we can't see missing images and all scripts load correctly.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint