Trident Ld

1 view
Skip to first unread message

Malcolm Lozada

unread,
Aug 5, 2024, 2:16:28 PM8/5/24
to alrdenintrig
Atrident (/ˈtraɪdənt/) is a three-pronged spear. It is used for spear fishing and historically as a polearm. As compared to an ordinary spear, the three tines increase the chance that a fish will be struck and decrease the chance that a fish will be able to dislodge itself if struck badly. On the other hand, they are not so many as to overly reduce the spear's concentration of force for piercing.

The trident is the tool of Poseidon (Greek) or Neptune (Roman) used for the protection of the sea realms, the god of the sea in classical mythology. Other sea deities such as Amphitrite or Triton were also often depicted with a trident in classical art. Later, tridents were used in medieval heraldry, sometimes held by a merman or triton. In Hinduism, it is the weapon of Shiva and is known as a trishula (Sanskrit for "triple-spear").


The Greek equivalent is τρίαινα (traina), from Proto-Greek trianja, meaning "threefold". The Greek term does not imply three of anything specific, and is vague about the shape, thus the assumption it was originally of "trident" form has been challenged.[2]


The Sanskrit name for the trident, trishula, is a compound of tri त्र for "three" and śūla शूल for "thorn", calling the trident's three prongs "thorns" rather than "teeth" or dant in Sanskrit, making the word "Tridant" for trident.[citation needed]


Poseidon struck a rock with his trident, causing a sea (or a saltwater spring, called the Erechtheis) to appear nearby on the Acropolis in Athens.[5][6] And according to Roman sources, Neptune struck the earth with the trident to produce the first warhorse.[7]


Poseidon, as well as being the god of the sea, was also known as the "Earth Shaker",[8] believed to cause earthquakes;[9][a] some commentators[who?] have extrapolated that the god would have used the trident to cause them,[10] possibly by striking the earth.[citation needed]


Turning to the retinue or a train of beings which follow the sea deities (the marine thiasos) the Tritons (mermen) may be seen bearing tridents.[15] Likewise, the Old Man of the Sea (halios geron) and the god Nereus are seen holding tridents.[15] Tritons, other mermen, and the Nereides can also carry rudders, oars, fish, or dolphins.[15]


Oceanus normally should not carry a trident, allowing him to be clearly distinguished from Poseidon. However, there is conflation of the deities in Romano-British iconography, and examples exist where the crab-claw headed Oceanus also bears a trident.[17][18] Oceanus holding a trident has been found on Romano-British coinage as well.[b][19]


In Hindu legends and stories Shiva, the Hindu god uses a trishula as his principal weapon. The trident is also said to represent three gunas mentioned in Indian Vedic philosophy namely sāttvika, rājasika, and tāmasika.[citation needed] The goddess Kali is sometimes portrayed with a trident as well.[22]


In religious Taoism, the trident represents the Taoist Trinity, the Three Pure Ones. In Taoist rituals, a trident bell is used to invite the presence of deities and summon spirits, as the trident signifies the highest authority of Heaven.[citation needed]


Tridents used in modern spear-fishing usually have barbed tines, which trap the speared fish firmly. In the Southern and Midwestern United States, gigging is used for harvesting suckers, bullfrogs, flounder and many species of rough fish.[29]


It has been used by farmers as a decorticator to remove leaves, seeds and buds from the stalks of plants such as flax and hemp.[citation needed] A form of trident is used by the gardians in the Camargue of southern France for herding cattle.[citation needed]


In Ancient Rome tridents (Latin: tridens or fuscina) were used by a type of gladiator called a retiarius or "net fighter". The retiarius was traditionally pitted against a secutor, and cast a net to wrap his adversary and then used the trident to fight him.[30][31]


A number of structures in the biological world are described as trident in appearance. Since at least the late 19th century the trident shape was applied to certain botanical shapes; for example, certain orchid flora were described as having trident-tipped lips in early botanical works.[33] Furthermore, in current botanical literature, certain bracts are stated to have a trident-shape (e.g. Douglas-fir).[34]


Trident developed from an earlier effort to provide exactly-once guarantees for Storm. While this earlier API is no longer present in Storm, the documentation provides a gentle introduction to some of the concepts used by Trident, and may be worth reading as an addendum to the Trident documentation.


Let's go through the code line by line. First a TridentTopology object is created, which exposes the interface for constructing Trident computations. TridentTopology has a method called newStream that creates a new stream of data in the topology reading from an input source. In this case, the input source is just the FixedBatchSpout defined from before. Input sources can also be queue brokers like Kestrel or Kafka. Trident keeps track of a small amount of state for each input source (metadata about what it has consumed) in Zookeeper, and the "spout1" string here specifies the node in Zookeeper where Trident should keep that metadata.


The rest of the topology computes word count and keeps the results persistently stored. First the stream is grouped by the "word" field. Then, each group is persistently aggregated using the Count aggregator. The persistentAggregate function knows how to store and update the results of the aggregation in a source of state. In this example, the word counts are kept in memory, but this can be trivially swapped to use Memcached, Cassandra, or any other persistent store. Swapping this topology to store counts in Memcached is as simple as replacing the persistentAggregate line with this (using trident-memcached), where the "serverLocations" is a list of host/ports for the Memcached cluster:


One of the cool things about Trident is that it has fully fault-tolerant, exactly-once processing semantics. This makes it easy to reason about your realtime processing. Trident persists state in a way so that if failures occur and retries are necessary, it won't perform multiple updates to the database for the same source data.


The persistentAggregate method transforms a Stream into a TridentState object. In this case the TridentState object represents all the word counts. We will use this TridentState object to implement the distributed query portion of the computation.


The next part of the topology implements a low latency distributed query on the word counts. The query takes as input a whitespace separated list of words and return the sum of the counts for those words. These queries are executed just like normal RPC calls, except they are parallelized in the background. Here's an example of how you might invoke one of these queries:


As you can see, it looks just like a regular remote procedure call (RPC), except it's executing in parallel across a Storm cluster. The latency for small queries like this are typically around 10ms. More intense DRPC queries can take longer of course, although the latency largely depends on how many resources you have allocated for the computation.


The same TridentTopology object is used to create the DRPC stream, and the function is named "words". The function name corresponds to the function name given in the first argument of execute when using a DRPCClient.


Each DRPC request is treated as its own little batch processing job that takes as input a single tuple representing the request. The tuple contains one field called "args" that contains the argument provided by the client. In this case, the argument is a whitespace separated list of words.


Next, words that didn't have a count are filtered out via the FilterNull filter and the counts are summed using the Sum aggregator to get the result. Then, Trident automatically sends the result back to the waiting client.


This topology will read from two sources of state. One database maps URLs to a list of people who tweeted that URL. The other database maps a person to a list of followers for that person. The topology definition looks like this:


The topology creates TridentState objects representing each external database using the newStaticState method. These can then be queried in the topology. Like all sources of state, queries to these databases will be automatically batched for maximum efficiency.


Next, the followers for each tweeter must be fetched. It's important that this step be parallelized, so shuffle is invoked to evenly distribute the tweeters among all workers for the topology. Then, the followers database is queried to get the list of followers for each tweeter. You can see that this portion of the topology is given a large parallelism since this is the most intense portion of the computation.


Next, the set of followers is uniqued and counted. This is done in two steps. First a "group by" is done on the batch by "follower", running the "One" aggregator on each group. The "One" aggregator simply emits a single tuple containing the number one for each group. Then, the ones are summed together to get the unique count of the followers set. Here's the definition of the "One" aggregator:


This is a "combiner aggregator", which knows how to do partial aggregations before transferring tuples over the network to maximize efficiency. Sum is also defined as a combiner aggregator, so the global sum done at the end of the topology will be very efficient.


The Trident data model is the TridentTuple which is a named list of values. During a topology, tuples are incrementally built up through a sequence of operations. Operations generally take in a set of input fields and emit a set of "function fields". The input fields are used to select a subset of the tuple as input to the operation, while the "function fields" name the fields the operation emits.

3a8082e126
Reply all
Reply to author
Forward
0 new messages