I would just like to thank a lot of people who answered my (most of the times 
inane) questions. I won’t mention names because I might miss one … but you guys 
know who you are. ☺ Thanks.

The migration wasn’t an easy one particularly with my setup. Our product is 
actually a garments manufacturing supply chain integration system built with C# 
using the SmartClient framework. The idea is that the client doesn’t need to 
install the software but instead go to a website to initiate the automatic 
download of needed libraries. The download should be minimal but still allow 
the communication with SAP, AS400 and a bunch of legacy applications 
(Warehousing, Finished goods, etc). So here, I only distribute 3 files with the 
systems which are:
1. J.EXE, J.DLL & Interport.JEXESERVER.DLL – J runtime
2. eoeUAS.DLL – a C# class library which acts as a wrapper for .NET. This class 
includes functions that are called by the main application to use J. I also 
imbed my IJS  (J Scripts) into this DLL as a resource and loaded upon class 
creation.

**J Usage
For this project, we used J to primarily calculate the following:
1. Raw Material Consumption – computes how many items of each material is 
needed to make one garment of a certain style, size and color. 
2. Raw Material Requirement – based on the raw material consumption, J computes 
for the actual number of number of materials that are needed to be ordered from 
the supplier based on the number of actual garments ordered by the customer.
J was a life saver because of its inherent capability to do matrix 
calculations. Original computations made in AS400 and VB was taking some time 
to complete because each material needed has to be looped through one by one. 
The number of materials not only includes the fabric but everything from 
thread, buttons, tags to adhesive tapes, plastic bags and packing cartons. The 
challenge here is how to make the computation run faster because of the 
iterative process of coming up with the raw material consumption which leads to 
changes in the raw material requirement. The operator would run the calculation 
a number of times a day because of availability materials or changes in the 
consumption and allowances or replacement of the materials itself.  With the 
competitiveness in the world market, a factory has to send out their orders to 
suppliers within 24 hours from receiving the confirmed orders from the 
customers. Missing the 24 hours limit normally means that the material is 
already out stock from suppliers and delays ensues.

** Problems Encountered during Migration
1. Deprecation of Profile (1!:45) – for the longest time this has been a 
problem. The original design of my wrapper class needed the profile for 
debugging purposes. Although not needed at runtime, without this I couldn’t 
properly support the software. This lead to a very significant change in how 
the wrapper class was developed.
2. Changes in the J OLE Server invocation – Although the changes were for the 
better, this problem kept me awake for a few nights. It was solved by RTFM.
3. J crashes after invocation – Invoking J from C# without creating a window 
took  some time to sort out. I now automatically load a hidden form at runtime. 

** Status
The migrated system is now up and running on the DEVELOPMENT servers. I have 
already requested for QA resources  for a 4 week testing and is waiting for 
confirmation. Initial, developer, testing looks good and stable. Looking 
forward to implementing this to the production servers by November of this 
year. 

I still have some systems running under J601 (production planning,  HR, etc) 
but I’ll wait for QA approval for this current system before I work on those.

** Some Design Constraints
The initial design of this system had J running on the server as a Windows 
Service. This lead to J using up 100% of only 1 CPU of the 4 CPU application 
server. With concurrent users increasing, the Windows Service started queuing 
up requests that the web server started timing-out the requests … even though 
they were still running and would complete successfully.  Since the web server 
already gave-up, the client was notified that an error occurred and the users 
reaction was to submit the same operation again and further slowing things 
down. It was a vicious circle.

What I did was abandoned the server side concept entirely and moved the 
processing on the client side. It is now running in this configuration, where 
the client system downloads all the data that it needs and computes it and J 
creates SQL statements that would insert, delete and/or update the database 
records.

When I first decided to change my execution design strategy, I had an idea that 
they may be some performance problems but I was thinking that I’ll just burn 
the bridge when I get there. So after more than half a year after 
implementation I encountered my first performance problem. You see, client 
machines on the factory were not really that powerful. A typical setup would be 
with the following specs:
Windows XP Professional
1.0GHz CPU
20GB HD
384 MB RAM

Normal J usage peaks at 70MB RAM but last month, there were some RMR 
calculation that the user says doesn’t finish. So I investigated and found out 
that because of the number of materials involved in the order, J usage was 
peaking at 130MB RAM. I then timed it and it took more than an hour to finish 
with J using up the CPU. So now, some users would kill the J process from the 
Task Manager and would complain that the system is “Hanged”. :D

For now, I’m trying to put in a progress dialog box into the mix (Oleg’s 
Progress Dialog to be precise) as an immediate solution but I am looking into 
an “easy” solution of running the code on the server. What I’m looking for are 
J libraries that would make it relatively easy to implement execution of J 
scripts on the server side (web server or application server behind the web 
server). Right now I’m looking at JHP but I’m still doing the leg work since I 
really need to complete the QA documentation requirements.

r/Alex
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to