Clojure & Terracotta - TIM

2 views
Skip to first unread message

Sergey Didenko

unread,
Nov 15, 2009, 2:47:32 PM11/15/09
to clo...@googlegroups.com
Hi from a Clojure newbie!

I have read the april thread "Clojure + Terracotta Update" and it
looks pretty positive.

A few question for TIM users:

Is there newer version than
http://github.com/pjstadig/tim-clojure-1.0-snapshot ?

Are there still bugs?

Can it be called production ready?

Regards, Sergey.

Paul Stadig

unread,
Nov 16, 2009, 1:32:00 PM11/16/09
to clo...@googlegroups.com
Hey Sergey,
I did the work on the Clojure TIM. I published a report of my findings at [1]. At least three of the roadblocks that I encountered were fixed in Terracotta 3.0.1 [2].

I believe the TIM works with Clojure 1.0, but it's been several months since I've looked at the code. There are still some issues with the Terracotta Integration:

1. It requires runtime replacement of some Clojure classes (which is fairly simple with Terracotta). It would be nice if these changes could be integrated into the Clojure codebase. It is daunting to think of having to maintain a set of changes that are replaced at runtime by Terracotta, but this could be done against each stable release of Clojure.

2. Currently the Clojure TIM shares all Vars, which causes a problem because the root binding of a Var can possibly be a non-portable class (such as an IO stream, or database connection...instances of these cannot meaningfully be shared across VMs). One (currently half pursued avenue) is to setup a way to share only certain Vars perhaps by adding some metadata that indicates the Var should be shared.

3. There is still a problem about how dynamically compiled classes should be shared across VMs. I believe the current TIM just permanently caches dynamically compiled classes, and they are never garbage collected. This might be a problem if many dynamically compiled classes are created, but in practice it may not be a problem depending on the circumstances.

I would love to hear of people's experience using this TIM. This was an academic exercise for me and I have not pursued this much more, because I'm not using it, and I haven't heard from anyone who is using it. I'd be glad to pick back up on this work and/or to add accept contributions from others.

Paul


[1] http://docs.google.com/Doc?id=dg7c7v49_241g5t8tqsv
[2] http://paul.stadig.name/2009/04/terracotta-bug-reports.html

Paul Stadig

unread,
Nov 16, 2009, 1:33:18 PM11/16/09
to clo...@googlegroups.com
Sorry! I forgot to say this, but the short answer is: No, I would not consider it to be production ready. It may be close, but it is not production ready.


Paul

On Sun, Nov 15, 2009 at 2:47 PM, Sergey Didenko <sergey....@gmail.com> wrote:

Sergey Didenko

unread,
Nov 16, 2009, 3:05:15 PM11/16/09
to clo...@googlegroups.com
Thanks for your answer, Paul!

I'm certainly going to try this TIM.

Another question:

You say that "it requires runtime replacement of some Clojure classes"
but the lines that include modified *TC.java files are commented ( see
"ClojureTerracottaConfigurator.java" from "tim-clojure-1.0-snapshot"
).

Does it mean that the TIM does not use modified clojure classes anymore?

Sergey Didenko

unread,
Nov 17, 2009, 12:43:04 PM11/17/09
to clo...@googlegroups.com
Hi Paul,

the code from [1] does not work under the latest Terracotta (3.1.1)
with clojure-slim.jar's in the following combinations:

1) branch "1.0.x" from [3]
2) branch "1.0.x" from [3] + modified
ClojureTerracottaConfigurator.java (uncommented lines)
3) [2] svn revision 1335 + modified ClojureTerracottaConfigurator.java
(uncommented lines)
4) [2] svn revision 1310 + modified ClojureTerracottaConfigurator.java
(uncommented lines)

Terracotta writes messages like

"Non-portable field name : clojure.lang.Var.root
Unshareable class : clojure.lang.XMLHandler
"

[1] http://github.com/pjstadig/tim-clojure-1.0-snapshot
[2] http://clojure.googlecode.com/svn
[3] http://github.com/richhickey/clojure

Paul Stadig

unread,
Nov 18, 2009, 5:14:41 PM11/18/09
to Clojure
Thanks for your feedback.

I was able to get it to work again and pushed some minor changes to
the git repo. I downloaded Terracotta 3.1.1, and followed the
instructions in the tim-clojure-1.0-SNAPSHOT/example/README. I ended
up uncommenting all of the code in ClojureTerracottaConfigurator.java.
I believe I had commented it out, because some of the replacement
classes were not necessary anymore, and I was going to trim it down to
the essential replacements, but I never finished the work.

The error you are experiencing might be because of one of the
outstanding issues. A non-portable class cannot be used as a root
binding for any Var. As I mentioned before, I have an idea for a
workaround, but have not pursued it as yet. If you'd like to help,
then let me know.


Paul

Sergey Didenko

unread,
Nov 19, 2009, 7:27:14 PM11/19/09
to clo...@googlegroups.com
Hi Paul,

This time I tested it under Linux, following the instructions exactly
and it worked.

Though when I opened the second REPL it failed with a
NullPointerException. I repeated the step and had two REPLs with the
same vars.

For some reason it failed earlier on Windows, I will try to make it work there.

Yes, I can try to help. Feel free to write me.

Actually, I would like to try Clojure + Terracotta as a data layer for
my Java app, so I'm more interested in adapting the changes to the
latest Clojure codebase and tuning Terracotta interaction. I saw
autolocking in config and now thinking how bad that can be.

I will study your google document and the changes to Clojure classes
to understand the TIM better.

P.S. (svn rev. 1335 + the new "tim-clojure")
Reply all
Reply to author
Forward
0 new messages